PageRenderTime 53ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/jboss-as-7.1.1.Final/domain-management/src/main/java/org/jboss/as/domain/management/DomainManagementMessages.java

#
Java | 541 lines | 119 code | 61 blank | 361 comment | 0 complexity | 01deee7dd2947dcf9025e64ef8bd3c9c MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
  1. /*
  2. * JBoss, Home of Professional Open Source.
  3. * Copyright 2011, Red Hat, Inc., and individual contributors
  4. * as indicated by the @author tags. See the copyright.txt file in the
  5. * distribution for a full listing of individual contributors.
  6. *
  7. * This is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU Lesser General Public License as
  9. * published by the Free Software Foundation; either version 2.1 of
  10. * the License, or (at your option) any later version.
  11. *
  12. * This software is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this software; if not, write to the Free
  19. * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  20. * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
  21. */
  22. package org.jboss.as.domain.management;
  23. import java.io.IOException;
  24. import java.util.Set;
  25. import javax.naming.NamingException;
  26. import javax.security.auth.callback.Callback;
  27. import javax.security.auth.callback.UnsupportedCallbackException;
  28. import org.jboss.as.controller.OperationFailedException;
  29. import org.jboss.logging.Cause;
  30. import org.jboss.logging.Message;
  31. import org.jboss.logging.MessageBundle;
  32. import org.jboss.logging.Messages;
  33. import org.jboss.logging.Param;
  34. import org.jboss.msc.service.StartException;
  35. /**
  36. * Date: 05.11.2011
  37. *
  38. * @author <a href="mailto:jperkins@redhat.com">James R. Perkins</a>
  39. * @author <a href="mailto:darran.lofthouse@jboss.com">Darran Lofthouse</a>
  40. */
  41. @MessageBundle(projectCode = "JBAS")
  42. public interface DomainManagementMessages {
  43. /**
  44. * The messages
  45. */
  46. DomainManagementMessages MESSAGES = Messages.getBundle(DomainManagementMessages.class);
  47. /**
  48. * Creates an exception indicating the verification could not be performed.
  49. *
  50. * @param cause the cause of the error.
  51. *
  52. * @return an {@link IOException} for the error.
  53. */
  54. @Message(id = 15220, value = "Unable to perform verification")
  55. IOException cannotPerformVerification(@Cause Throwable cause);
  56. /**
  57. * Creates an exception indicating the realm was invalid.
  58. *
  59. * @param realm the invalid realm.
  60. * @param expectedRealm the expected realm.
  61. *
  62. * @return an {@link IllegalStateException} for the error.
  63. */
  64. @Message(id = 15221, value = "Invalid Realm '%s' expected '%s'")
  65. IllegalStateException invalidRealm(String realm, String expectedRealm);
  66. /**
  67. * Creates an exception indicating the referral for authentication could not be followed.
  68. *
  69. * @param name the invalid name.
  70. *
  71. * @return a {@link NamingException} for the error.
  72. */
  73. @Message(id = 15222, value = "Can't follow referral for authentication: %s")
  74. NamingException nameNotFound(String name);
  75. /**
  76. * Creates an exception indicating no authentication mechanism was defined in the security realm.
  77. *
  78. * @return an {@link IllegalStateException} for the error.
  79. */
  80. @Message(id = 15223, value = "No authentication mechanism defined in security realm.")
  81. IllegalStateException noAuthenticationDefined();
  82. /**
  83. * Creates an exception indicating no username was provided.
  84. *
  85. * @return an {@link IOException} for the error.
  86. */
  87. @Message(id = 15224, value = "No username provided.")
  88. IOException noUsername();
  89. /**
  90. * Creates an exception indicating no password was provided.
  91. *
  92. * @return an {@link IOException} for the error.
  93. */
  94. @Message(id = 15225, value = "No password to verify.")
  95. IOException noPassword();
  96. /**
  97. * Creates an exception indicating that one of {@code attr1} or {@code attr2} is required.
  98. *
  99. * @param attr1 the first attribute.
  100. * @param attr2 the second attribute.
  101. *
  102. * @return an {@link IllegalArgumentException} for the error.
  103. */
  104. @Message(id = 15226, value = "One of '%s' or '%s' required.")
  105. IllegalArgumentException oneOfRequired(String attr1, String attr2);
  106. /**
  107. * Creates an exception indicating the realm is not supported.
  108. *
  109. * @param callback the callback used to create the exception.
  110. *
  111. * @return an {@link UnsupportedCallbackException} for the error.
  112. */
  113. @Message(id = 15227, value = "Realm choice not currently supported.")
  114. UnsupportedCallbackException realmNotSupported(@Param Callback callback);
  115. /**
  116. * Creates an exception indicating the properties could not be loaded.
  117. *
  118. * @param cause the cause of the error.
  119. *
  120. * @return a {@link StartException} for the error.
  121. */
  122. @Message(id = 15228, value = "Unable to load properties")
  123. StartException unableToLoadProperties(@Cause Throwable cause);
  124. /**
  125. * Creates an exception indicating the inability to start the service.
  126. *
  127. * @param cause the cause of the error.
  128. *
  129. * @return a {@link StartException} for the error.
  130. */
  131. @Message(id = 15229, value = "Unable to start service")
  132. StartException unableToStart(@Cause Throwable cause);
  133. /**
  134. * A message indicating the user, represented by the {@code username} parameter, was not found.
  135. *
  136. * @param username the username not found.
  137. *
  138. * @return the message.
  139. */
  140. @Message(id = 15230, value = "User '%s' not found.")
  141. String userNotFound(String username);
  142. /**
  143. * Creates an exception indicating the user, represented by the {@code username} parameter, was not found in the
  144. * directory.
  145. *
  146. * @param username the username not found.
  147. *
  148. * @return an {@link IOException} for the error.
  149. */
  150. @Message(id = 15231, value = "User '%s' not found in directory.")
  151. IOException userNotFoundInDirectory(String username);
  152. /**
  153. * Creates an exception indicating that no java.io.Console is available.
  154. *
  155. * @return a {@link IllegalStateException} for the error.
  156. */
  157. @Message(id = 15232, value = "No java.io.Console available to interact with user.")
  158. IllegalStateException noConsoleAvailable();
  159. /**
  160. * A message indicating JBOSS_HOME not set.
  161. *
  162. * @return a {@link String} for the message.
  163. */
  164. @Message(id = 15233, value = "JBOSS_HOME environment variable not set.")
  165. String jbossHomeNotSet();
  166. /**
  167. * A message indicating no mgmt-users.properties have been found.
  168. *
  169. * @return a {@link String} for the message.
  170. */
  171. @Message(id = 15234, value = "No %s files found.")
  172. String propertiesFileNotFound(String file);
  173. /**
  174. * A message prompting the user to enter the details of the user being added.
  175. *
  176. * @return a {@link String} for the message.
  177. */
  178. @Message(value = "Enter the details of the new user to add.")
  179. String enterNewUserDetails();
  180. /**
  181. * The prompt to obtain the realm from the user.
  182. *
  183. * @param realm - the default realm.
  184. *
  185. * @return a {@link String} for the message.
  186. */
  187. @Message(value = "Realm (%s)")
  188. String realmPrompt(String realm);
  189. /**
  190. * The prompt to obtain the new username from the user.
  191. *
  192. * @return a {@link String} for the message.
  193. */
  194. @Message(value = "Username")
  195. String usernamePrompt();
  196. /**
  197. * The prompt to obtain the new username from the user.
  198. *
  199. * @param defaultUsername - The default username if no value is entered.
  200. *
  201. * @return a {@link String} for the message.
  202. */
  203. @Message(value = "Username (%s)")
  204. String usernamePrompt(String defaultUsername);
  205. /**
  206. * The error message if no username is entered.
  207. *
  208. * @return a {@link String} for the message.
  209. */
  210. @Message(id = 15235, value = "No Username entered, exiting.")
  211. String noUsernameExiting();
  212. /**
  213. * The prompt to obtain the password from the user.
  214. *
  215. * @return a {@link String} for the message.
  216. */
  217. @Message(value = "Password")
  218. String passwordPrompt();
  219. /**
  220. * The error message if no password is entered.
  221. *
  222. * @return a {@link String} for the message.
  223. */
  224. @Message(id = 15236, value = "No Password entered, exiting.")
  225. String noPasswordExiting();
  226. /**
  227. * The prompt to obtain the password confirmation from the user.
  228. *
  229. * @return a {@link String} for the message.
  230. */
  231. @Message(value = "Re-enter Password")
  232. String passwordConfirmationPrompt();
  233. /**
  234. * The error message if the passwords do not match.
  235. *
  236. * @return a {@link String} for the message.
  237. */
  238. @Message(id = 15237, value = "The passwords do not match.")
  239. String passwordMisMatch();
  240. /**
  241. * The error message if the username and password are equal.
  242. *
  243. * @return a {@link String} for the message.
  244. */
  245. @Message(id = 15238, value = "Username must not match the password.")
  246. String usernamePasswordMatch();
  247. /**
  248. * The error message if the username is not alpha numeric
  249. *
  250. * @return a {@link String} for the message.
  251. */
  252. @Message(id = 15239, value = "Only alpha/numeric usernames accepted.")
  253. String usernameNotAlphaNumeric();
  254. /**
  255. * Confirmation of the user being added.
  256. *
  257. * @param username - The new username.
  258. * @param realm - The realm the user is being added for.
  259. *
  260. * @return a {@link String} for the message.
  261. */
  262. @Message(value = "About to add user '%s' for realm '%s'")
  263. String aboutToAddUser(String username, String realm);
  264. /**
  265. * Prompt to ask user to confirm yes or no.
  266. *
  267. * @return a {@link String} for the message.
  268. */
  269. @Message(value = "Is this correct yes/no?")
  270. String isCorrectPrompt();
  271. /**
  272. * Warning that the username is easy to guess.
  273. *
  274. * @param username - The new username.
  275. *
  276. * @return a {@link String} for the message.
  277. */
  278. @Message(value = "The username '%s' is easy to guess")
  279. String usernameEasyToGuess(String username);
  280. /**
  281. * A prompt to double check the user is really sure they want to add this user.
  282. *
  283. * @param username - The new username.
  284. *
  285. * @return a {@link String} for the message.
  286. */
  287. @Message(value = "Are you sure you want to add user '%s' yes/no?")
  288. String sureToAddUser(String username);
  289. /**
  290. * The error message if the confirmation response is invalid.
  291. *
  292. * TODO - On translation we will need support for checking the possible responses.
  293. *
  294. * @return a {@link String} for the message.
  295. */
  296. @Message(id = 15240, value = "Invalid response. (Valid responses are yes, y, no, and n)")
  297. String invalidConfirmationResponse();
  298. /**
  299. * Message to inform user that the new user has been added to the file identified.
  300. *
  301. * @param username - The new username.
  302. * @param fileName - The file the user has been added to.
  303. *
  304. * @return a {@link String} for the message.
  305. */
  306. @Message(value = "Added user '%s' to file '%s'")
  307. String addedUser(String username, String fileName);
  308. /**
  309. * The error message if adding the user to the file fails.
  310. *
  311. * @param file - The name of the file the add failed for.
  312. * @param error - The failure message.
  313. *
  314. * @return a {@link String} for the message.
  315. */
  316. @Message(id = 15241, value = "Unable to add user to %s due to error %s")
  317. String unableToAddUser(String file, String error);
  318. /**
  319. * The error message if loading the known users from file fails.
  320. *
  321. * @param file - The name of the file the load failed for.
  322. * @param error - The failure message.
  323. *
  324. * @return a {@link String} for the message.
  325. */
  326. @Message(id = 15242, value = "Unable to add load users from %s due to error %s")
  327. String unableToLoadUsers(String file, String error);
  328. /**
  329. * The error message if the user is already in at least one file.
  330. *
  331. * @param user - The name of the user.
  332. *
  333. * @return a {@link String} for the message.
  334. */
  335. @Message(id = 15243, value = "The user '%s' already exists in at least one properties file.")
  336. String duplicateUser(String user);
  337. /**
  338. * The error message header.
  339. *
  340. * @return a {@link String} for the message.
  341. */
  342. @Message(value = "Error")
  343. String errorHeader();
  344. /**
  345. * Error message if more than one username/password authentication mechanism is defined.
  346. *
  347. * @param realmName the name of the security realm
  348. * @param mechanisms the set of mechanisms .
  349. *
  350. * @return an {@link OperationFailedException} for the error.
  351. */
  352. @Message(id = 15244, value = "Configuration for security realm '%s' includes multiple username/password based authentication mechanisms (%s). Only one is allowed")
  353. OperationFailedException multipleAuthenticationMechanismsDefined(String realmName, Set<String> mechanisms);
  354. /**
  355. * Creates an exception indicating no authentication mechanism was defined in the security realm.
  356. *
  357. * @param realmName the security realm name
  358. *
  359. * @return an {@link OperationFailedException} for the error.
  360. */
  361. @Message(id = 15245, value = "No authentication mechanism defined in security realm '%s'.")
  362. OperationFailedException noAuthenticationDefined(String realmName);
  363. /**
  364. * Creates an exception indicating that one of {@code attr1} or {@code attr2} is required.
  365. *
  366. * @param attr1 the first attribute.
  367. * @param attr2 the second attribute.
  368. *
  369. * @return an {@link OperationFailedException} for the error.
  370. */
  371. @Message(id = 15246, value = "One of '%s' or '%s' required.")
  372. OperationFailedException operationFailedOneOfRequired(String attr1, String attr2);
  373. /**
  374. * Creates an exception indicating that only one of {@code attr1} or {@code attr2} is required.
  375. *
  376. * @param attr1 the first attribute.
  377. * @param attr2 the second attribute.
  378. *
  379. * @return an {@link OperationFailedException} for the error.
  380. */
  381. @Message(id = 15247, value = "Only one of '%s' or '%s' is required.")
  382. OperationFailedException operationFailedOnlyOneOfRequired(String attr1, String attr2);
  383. /**
  384. * Creates an IllegalArgumentException indicating that a value can not be null.
  385. *
  386. * @param name - The name of the parameter that can not be null.
  387. * @return an {@link IllegalArgumentException} for the error.
  388. */
  389. @Message(id = 15248, value = "'%s' can not be null.")
  390. IllegalArgumentException canNotBeNull(String name);
  391. /**
  392. * Creates a String for use in an OperationFailedException to indicate that no security context has been established for a
  393. * call that requires one.
  394. */
  395. @Message(id = 15249, value = "No security context has been established.")
  396. String noSecurityContextEstablished();
  397. /**
  398. * Creates a String for use in an OperationFailedException to indicate that an unexpected number of RealmUser instances have
  399. * been found.
  400. *
  401. * @param count - The number of RealmUser instances found.
  402. */
  403. @Message(id = 15250, value = "An unexpected number (%d) of RealmUsers are associated with the SecurityContext.")
  404. String unexpectedNumberOfRealmUsers(int count);
  405. /**
  406. * Prompt for the file to update in add-users
  407. */
  408. @Message(value = "What type of user do you wish to add? %n a) Management User (mgmt-users.properties) %n b) Application User (application-users.properties)")
  409. String filePrompt();
  410. /**
  411. * Prompt the user for the roles to add the user to
  412. * @return
  413. */
  414. @Message(value = "What roles do you want this user to belong to? (Please enter a comma separated list, or leave blank for none)")
  415. String rolesPrompt();
  416. /**
  417. * Message to inform user that the new user has been added to the roles file identified.
  418. *
  419. * @param username - The new username.
  420. * @param roles - The new roles.
  421. * @param fileName - The file the user has been added to.
  422. *
  423. * @return a {@link String} for the message.
  424. */
  425. @Message(value = "Added user '%s' with roles %s to file '%s'")
  426. String addedRoles(String username, String roles, String fileName);
  427. /**
  428. * The error message if the choice response is invalid.
  429. *
  430. * TODO - On translation we will need support for checking the possible responses.
  431. *
  432. * @return a {@link String} for the message.
  433. */
  434. @Message(id = 15251, value = "Invalid response. (Valid responses are A, a, B, or b)")
  435. String invalidChoiceResponse();
  436. /**
  437. * Confirmation if the current user password and roles is about to be updated.
  438. *
  439. * @param user - The name of the user.
  440. *
  441. * @return a {@link String} for the message.
  442. */
  443. @Message(value = "User '%s' already exits, would you like to update the existing user password and roles")
  444. String aboutToUpdateUser(String user);
  445. /**
  446. * Message to inform user that the user has been updated to the file identified.
  447. *
  448. * @param username - The new username.
  449. * @param fileName - The file the user has been added to.
  450. *
  451. * @return a {@link String} for the message.
  452. */
  453. @Message(value = "Updated user '%s' to file '%s'")
  454. String updateUser(String userName, String canonicalPath);
  455. /**
  456. * The error message if updating user to the file fails.
  457. *
  458. * @param file - The name of the file the add failed for.
  459. * @param error - The failure message.
  460. *
  461. * @return a {@link String} for the message.
  462. */
  463. @Message(id = 15254, value = "Unable to update user to %s due to error %s")
  464. String unableToUpdateUser(String absolutePath, String message);
  465. /**
  466. * Message to inform user that the user has been updated to the roles file identified.
  467. *
  468. * @param username - The new username.
  469. * @param roles - The new roles.
  470. * @param fileName - The file the user has been added to.
  471. *
  472. * @return a {@link String} for the message.
  473. */
  474. @Message(value = "Updated user '%s' with roles %s to file '%s'")
  475. String updatedRoles(String username, String roles, String fileName);
  476. /*
  477. * Logging IDs 15200 to 15299 are reserved for domain management, the file DomainManagementLogger also contains messages in
  478. * this range commencing 15200.
  479. */
  480. }