Permalink
Browse files

drop

  • Loading branch information...
1 parent 7b5b8ea commit afbb42419ae9bded60f8c3039f925bb8705540e8 @jdillon jdillon committed May 22, 2013
Showing with 0 additions and 19,659 deletions.
  1. +0 −31 .gitignore
  2. +0 −98 README.md
  3. +0 −10 header.txt
  4. +0 −61 nexus-bootstrap/pom.xml
  5. +0 −330 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/Launcher.java
  6. +0 −66 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/ShutdownHelper.java
  7. +0 −111 ...ootstrap/src/main/java/org/sonatype/nexus/bootstrap/jetty/InstrumentedSelectChannelConnector.java
  8. +0 −81 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/JswLauncher.java
  9. +0 −35 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/JswShutdownDelegate.java
  10. +0 −74 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/WrapperListenerSupport.java
  11. +0 −68 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/WrapperLog.java
  12. +0 −61 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/LogProxy.java
  13. +0 −69 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/Slf4jLogProxy.java
  14. +0 −74 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/SystemOutLogProxy.java
  15. +0 −136 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/CommandMonitorTalker.java
  16. +0 −172 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/CommandMonitorThread.java
  17. +0 −149 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/KeepAliveThread.java
  18. +0 −43 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/ExitCommand.java
  19. +0 −43 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/HaltCommand.java
  20. +0 −44 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/PingCommand.java
  21. +0 −58 ...bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/StopApplicationCommand.java
  22. +0 −44 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/StopMonitorCommand.java
  23. +0 −18 nexus-bootstrap/src/main/resources/org/sonatype/nexus/bootstrap/default.properties
  24. +0 −73 nexus-bootstrap/src/test/java/org/sonatype/nexus/bootstrap/monitor/KeepAliveThreadTest.java
  25. +0 −37 nexus-client-core-testsuite/pom.xml
  26. +0 −35 nexus-client-core-testsuite/src/test/filtered-resources/logback-test.xml
  27. BIN ...nt-core-testsuite/src/test/it-resources/artifacts/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
  28. +0 −15 ...nt-core-testsuite/src/test/it-resources/artifacts/aopalliance/aopalliance/1.0/aopalliance-1.0.pom
  29. +0 −24 ...-client-core-testsuite/src/test/it-resources/artifacts/aopalliance/aopalliance/maven-metadata.xml
  30. +0 −96 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/ArtifactMavenIT.java
  31. +0 −101 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/ContentIT.java
  32. +0 −145 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/ErrorHandlingIT.java
  33. +0 −47 ...client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/NexusClientITSupport.java
  34. +0 −296 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/RepositoriesIT.java
  35. +0 −115 ...-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/RepositoryTargetsIT.java
  36. +0 −145 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/RoutingIT.java
  37. +0 −295 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/SecurityIT.java
  38. +0 −48 nexus-client-core-testsuite/src/test/java/org/sonatype/nexus/client/testsuite/UserIT.java
  39. +0 −22 nexus-client-core/README.md
  40. +0 −185 nexus-client-core/pom.xml
  41. +0 −27 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/Condition.java
  42. +0 −77 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/NexusClient.java
  43. +0 −203 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/NexusStatus.java
  44. +0 −95 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/condition/EditionConditions.java
  45. +0 −142 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/condition/LogicalConditions.java
  46. +0 −85 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/condition/NexusStatusConditions.java
  47. +0 −151 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/condition/VersionConditions.java
  48. +0 −39 ...e/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientAccessForbiddenException.java
  49. +0 −37 ...t-core/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientBadRequestException.java
  50. +0 −95 ...ore/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientErrorResponseException.java
  51. +0 −41 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientException.java
  52. +0 −37 ...ent-core/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientNotFoundException.java
  53. +0 −64 ...ent-core/src/main/java/org/sonatype/nexus/client/core/exception/NexusClientResponseException.java
  54. +0 −30 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/spi/SubsystemFactory.java
  55. +0 −35 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/spi/SubsystemSupport.java
  56. +0 −60 ...core/src/main/java/org/sonatype/nexus/client/core/spi/subsystem/repository/RepositoryFactory.java
  57. +0 −46 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/Entity.java
  58. +0 −48 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/EntityRepository.java
  59. +0 −31 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/ServerConfiguration.java
  60. +0 −25 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/Utilities.java
  61. +0 −29 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/artifact/ArtifactMaven.java
  62. +0 −102 ...s-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/artifact/ResolveRequest.java
  63. +0 −173 ...-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/artifact/ResolveResponse.java
  64. +0 −26 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/config/OptionalSegment.java
  65. +0 −36 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/config/RemoteProxy.java
  66. +0 −29 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/config/Segment.java
  67. +0 −54 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/content/Content.java
  68. +0 −74 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/content/Location.java
  69. +0 −42 ...client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/BaseRepository.java
  70. +0 −52 ...lient-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/GroupRepository.java
  71. +0 −47 ...ient-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/HostedRepository.java
  72. +0 −100 ...lient-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/ProxyRepository.java
  73. +0 −34 ...core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/ProxyRepositoryStatus.java
  74. +0 −67 ...s-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/Repositories.java
  75. +0 −91 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/Repository.java
  76. +0 −28 ...ient-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/RepositoryStatus.java
  77. +0 −37 ...ent-core/src/main/java/org/sonatype/nexus/client/core/subsystem/repository/VirtualRepository.java
  78. +0 −27 ...src/main/java/org/sonatype/nexus/client/core/subsystem/repository/maven/MavenGroupRepository.java
  79. +0 −41 ...rc/main/java/org/sonatype/nexus/client/core/subsystem/repository/maven/MavenHostedRepository.java
  80. +0 −27 ...main/java/org/sonatype/nexus/client/core/subsystem/repository/maven/MavenM1VirtualRepository.java
  81. +0 −69 ...src/main/java/org/sonatype/nexus/client/core/subsystem/repository/maven/MavenProxyRepository.java
  82. +0 −81 ...t-core/src/main/java/org/sonatype/nexus/client/core/subsystem/routing/DiscoveryConfiguration.java
  83. +0 −71 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/routing/Routing.java
  84. +0 −256 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/routing/Status.java
  85. +0 −56 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/Privilege.java
  86. +0 −34 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/Privileges.java
  87. +0 −48 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/Role.java
  88. +0 −26 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/Roles.java
  89. +0 −54 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/User.java
  90. +0 −26 nexus-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/security/Users.java
  91. +0 −41 ...-client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/targets/RepositoryTarget.java
  92. +0 −26 ...client-core/src/main/java/org/sonatype/nexus/client/core/subsystem/targets/RepositoryTargets.java
  93. +0 −112 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/msg/ErrorMessage.java
  94. +0 −123 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/msg/ErrorResponse.java
  95. +0 −129 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/rest/AbstractNexusClient.java
  96. +0 −74 ...client-core/src/main/java/org/sonatype/nexus/client/internal/rest/AbstractNexusClientFactory.java
  97. +0 −44 ...client-core/src/main/java/org/sonatype/nexus/client/internal/rest/AbstractXStreamNexusClient.java
  98. +0 −64 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/rest/NexusXStreamFactory.java
  99. +0 −113 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/rest/XStreamXmlProvider.java
  100. +0 −85 ...e/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/JerseyArtifactMaven.java
  101. +0 −265 ...nt-core/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/JerseyContent.java
  102. +0 −149 ...e/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/JerseyEntitySupport.java
  103. +0 −53 ...main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/JerseyServerConfiguration.java
  104. +0 −52 ...-core/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/JerseyUtilities.java
  105. +0 −38 ...org/sonatype/nexus/client/internal/rest/jersey/subsystem/config/JerseyOptionalSegmentSupport.java
  106. +0 −66 .../main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/config/JerseyRemoteProxy.java
  107. +0 −134 ...in/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/config/JerseySegmentSupport.java
  108. +0 −212 ...va/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyGroupRepository.java
  109. +0 −70 ...sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyGroupRepositoryFactory.java
  110. +0 −112 ...a/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyHostedRepository.java
  111. +0 −69 ...onatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyHostedRepositoryFactory.java
  112. +0 −199 ...va/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyProxyRepository.java
  113. +0 −70 ...sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyProxyRepositoryFactory.java
  114. +0 −232 .../java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyRepositories.java
  115. +0 −329 ...in/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyRepository.java
  116. +0 −74 .../org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyVirtualRepository.java
  117. +0 −70 ...natype/nexus/client/internal/rest/jersey/subsystem/repository/JerseyVirtualRepositoryFactory.java
  118. +0 −52 ...rg/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/ProxyRepositoryStatusImpl.java
  119. +0 −39 ...ava/org/sonatype/nexus/client/internal/rest/jersey/subsystem/repository/RepositoryStatusImpl.java
  120. +0 −52 ...type/nexus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenGroupRepository.java
  121. +0 −69 ...xus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenGroupRepositoryFactory.java
  122. +0 −68 ...ype/nexus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenHostedRepository.java
  123. +0 −68 ...us/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenHostedRepositoryFactory.java
  124. +0 −53 .../nexus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenM1VirtualRepository.java
  125. +0 −69 ...client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenM1VirtualRepositoryFactory.java
  126. +0 −99 ...type/nexus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenProxyRepository.java
  127. +0 −69 ...xus/client/internal/rest/jersey/subsystem/repository/maven/JerseyMavenProxyRepositoryFactory.java
  128. +0 −176 ...src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/routing/JerseyRouting.java
  129. +0 −346 .../main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyPrivilege.java
  130. +0 −138 ...main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyPrivileges.java
  131. +0 −207 ...e/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyRole.java
  132. +0 −128 .../src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyRoles.java
  133. +0 −231 ...e/src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyUser.java
  134. +0 −128 .../src/main/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/security/JerseyUsers.java
  135. +0 −194 ...java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/targets/JerseyRepositoryTarget.java
  136. +0 −163 ...ava/org/sonatype/nexus/client/internal/rest/jersey/subsystem/targets/JerseyRepositoryTargets.java
  137. +0 −65 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/util/Check.java
  138. +0 −65 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/util/Template.java
  139. +0 −85 nexus-client-core/src/main/java/org/sonatype/nexus/client/internal/util/Version.java
  140. +0 −21 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/AuthenticationInfo.java
  141. +0 −107 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/BaseUrl.java
  142. +0 −79 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/ConnectionInfo.java
  143. +0 −38 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/NexusClientFactory.java
  144. +0 −21 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/Protocol.java
  145. +0 −69 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/ProxyInfo.java
  146. +0 −50 ...-client-core/src/main/java/org/sonatype/nexus/client/rest/UsernamePasswordAuthenticationInfo.java
  147. +0 −33 ...re/src/main/java/org/sonatype/nexus/client/rest/jersey/ContextAwareUniformInterfaceException.java
  148. +0 −369 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/jersey/JerseyNexusClient.java
  149. +0 −230 nexus-client-core/src/main/java/org/sonatype/nexus/client/rest/jersey/JerseyNexusClientFactory.java
  150. +0 −31 ...-client-core/src/main/java/org/sonatype/nexus/client/rest/jersey/NexusClientHandlerException.java
  151. +0 −51 ...ain/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyArtifactMavenSubsystemFactory.java
  152. +0 −51 .../src/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyContentSubsystemFactory.java
  153. +0 −56 ...c/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyPrivilegesSubsystemFactory.java
  154. +0 −63 ...core/src/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyRepositoriesFactory.java
  155. +0 −57 ...java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyRepositoryTargetsSubsystemFactory.java
  156. +0 −54 ...re/src/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyRolesSubsystemFactory.java
  157. +0 −52 ...ient-core/src/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyRoutingFactory.java
  158. +0 −53 ...c/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyServerConfigurationFactory.java
  159. +0 −54 ...re/src/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyUsersSubsystemFactory.java
  160. +0 −51 ...rc/main/java/org/sonatype/nexus/client/rest/jersey/subsystem/JerseyUtilitiesSubsystemFactory.java
  161. +0 −26 nexus-client-core/src/main/java/org/sonatype/plexus/rest/xstream/LookAheadStreamReader.java
  162. +0 −92 nexus-client-core/src/main/java/org/sonatype/plexus/rest/xstream/xml/LookAheadXppDriver.java
  163. +0 −265 nexus-client-core/src/main/java/org/sonatype/plexus/rest/xstream/xml/LookAheadXppReader.java
  164. +0 −2 ...test/filtered-resources/META-INF/maven/org.sonatype.nexus.client/nexus-client-core/pom.properties
  165. +0 −139 ...t/java/org/sonatype/nexus/client/internal/rest/jersey/subsystem/config/JerseyRemoteProxyTest.java
  166. +0 −60 nexus-client-core/src/test/java/org/sonatype/nexus/client/rest/BaseUrlTest.java
  167. +0 −98 nexus-client-core/src/test/java/org/sonatype/nexus/client/rest/jersey/BasicJerseyNexusClientIT.java
  168. +0 −84 ...client-core/src/test/java/org/sonatype/nexus/client/rest/jersey/JerseyNexusClientFactoryTest.java
  169. +0 −43 ...client-core/src/test/java/org/sonatype/nexus/client/rest/jersey/JerseyNexusClientTestSupport.java
  170. +0 −64 ...-core/src/test/java/org/sonatype/nexus/client/rest/jersey/JerseyNexusTestClientUserAgentTest.java
  171. +0 −50 nexus-compat/pom.xml
  172. +0 −105 nexus-compat/src/main/java/org/sonatype/nexus/compat/EventBusApplicationEventMulticaster.java
  173. +0 −32 nexus-compat/src/main/java/org/sonatype/plexus/appevents/AbstractApplicationEventListener.java
  174. +0 −79 nexus-compat/src/main/java/org/sonatype/plexus/appevents/AbstractEvent.java
  175. +0 −26 nexus-compat/src/main/java/org/sonatype/plexus/appevents/ApplicationEventMulticaster.java
  176. +0 −43 nexus-compat/src/main/java/org/sonatype/plexus/appevents/Event.java
  177. +0 −37 nexus-compat/src/main/java/org/sonatype/plexus/appevents/EventListener.java
  178. +0 −47 nexus-compat/src/main/java/org/sonatype/plexus/appevents/EventMulticaster.java
  179. +0 −34 nexus-compat/src/main/java/org/sonatype/plugin/ExtensionPoint.java
  180. +0 −33 nexus-compat/src/main/java/org/sonatype/plugin/Managed.java
  181. +0 −33 nexus-compat/src/main/java/org/sonatype/security/events/AuthorizationConfigurationChangedEvent.java
  182. +0 −33 nexus-compat/src/main/java/org/sonatype/security/events/SecurityConfigurationChangedEvent.java
  183. +0 −66 nexus-compat/src/main/java/org/sonatype/security/events/UserPrincipalsExpiredEvent.java
  184. +0 −148 nexus-configuration-model/pom.xml
  185. +0 −313 nexus-configuration-model/src/main/filtered-resources/META-INF/nexus/default-oss-nexus.xml
  186. +0 −64 nexus-configuration-model/src/main/java/org/sonatype/nexus/configuration/Configurable.java
  187. +0 −29 nexus-configuration-model/src/main/java/org/sonatype/nexus/configuration/CoreConfiguration.java
  188. +0 −24 nexus-configuration-model/src/main/java/org/sonatype/nexus/configuration/ExternalConfiguration.java
  189. +0 −52 ...s-configuration-model/src/main/java/org/sonatype/nexus/configuration/RevertableConfiguration.java
  190. +0 −2,195 nexus-configuration-model/src/main/mdo/nexus-old.xml
  191. +0 −1,424 nexus-configuration-model/src/main/mdo/nexus.xml
Sorry, we could not display the entire diff because too many files (7,380) changed.
View
31 .gitignore
@@ -1,31 +0,0 @@
-# Ignores for Sonatype Nexus Core
-# Language is Java
-# Build tool is Apache Maven2/3
-# IDE used is Eclipse MSE
-# so, we have to ignore all the specifics of these above
-
-# Eclipse related (and M2e)
-.classpath
-.project
-.settings/
-
-# Maven related (and some plugins)
-target/
-*.ser
-*.ec
-
-# Intellij
-*.ipr
-*.iml
-*.iws
-.idea/
-
-# Other
-.svn/
-.benchmarks.*.db
-
-# Junk (to be cleaned up)
-#nexus/nexus-test-harness/nexus-test-harness-its/velocity.log*
-
-#nexus/nexus-test-harness/nexus-test-harness-its/test-output
-#nexus/nexus-clients/nexus-rest-client-java/test-output/
View
98 README.md
@@ -1,98 +0,0 @@
-<!--
-
- Sonatype Nexus (TM) Open Source Version
- Copyright (c) 2007-2013 Sonatype, Inc.
- All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-
- This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-
- Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- Eclipse Foundation. All other trademarks are the property of their respective owners.
-
--->
-
-# Sonatype Nexus Core
-
-This is the Core codebase of Sonatype Nexus, aka "Nexus OSS".
-
-## Quick Links
-
-* [Product homepage](http://www.sonatype.org/nexus/participate)
-* [Public source repository](https://github.com/sonatype/nexus)
-* [Issue tracking](https://issues.sonatype.org/browse/NEXUS)
-* [Public wiki](https://docs.sonatype.com/display/SPRTNXOSS)
-
-## Building
-
-To build this project you need recent version of Apache Maven (3.0.4+) and Sonatype Forge set up as mirror at least.
-Example Maven settings XML:
-
-```
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Sonatype Nexus (TM) Open Source Version
- Copyright (c) 2007-2013 Sonatype, Inc.
- All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-
- This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-
- Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- Eclipse Foundation. All other trademarks are the property of their respective owners.
-
--->
-<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
- <mirrors>
- <mirror>
- <!-- This sends everything to Forge -->
- <id>sonatype-forge</id>
- <mirrorOf>external:*</mirrorOf>
- <url>https://repository.sonatype.org/content/groups/sonatype-public-grid/</url>
- </mirror>
- </mirrors>
- <profiles>
- <profile>
- <id>nexus</id>
- <!-- Enable snapshots for the built in central repo to direct -->
- <!-- all requests to nexus via the mirror -->
- <repositories>
- <repository>
- <id>central</id>
- <url>http://central</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </repository>
- </repositories>
- <pluginRepositories>
- <pluginRepository>
- <id>central</id>
- <url>http://central</url>
- <releases><enabled>true</enabled></releases>
- <snapshots><enabled>true</enabled></snapshots>
- </pluginRepository>
- </pluginRepositories>
- </profile>
- </profiles>
- <activeProfiles>
- <!-- make the profile active all the time -->
- <activeProfile>nexus</activeProfile>
- </activeProfiles>
- <pluginGroups>
- <!-- define the sonatype plugin group, so the nexus plugins will work without typing the groupId -->
- <pluginGroup>org.sonatype.plugins</pluginGroup>
- </pluginGroups>
-</settings>
-```
-
-Note: As Maven "best practice", it is highly recommended to set up your own instance of Nexus and your local builds should use it instead of directly
-reaching out, fetch from remote. In such case, to properly proxy the forge URL above, be sure to add both release and snapshot proxy repositories for it, as
-it is actually a repository group having "mixed" repository policy.
-
-Have fun,
-Sonatype Team
View
10 header.txt
@@ -1,10 +0,0 @@
-Sonatype Nexus (TM) Open Source Version
-Copyright (c) 2007-2013 Sonatype, Inc.
-All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-
-This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
-which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-
-Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
-of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
-Eclipse Foundation. All other trademarks are the property of their respective owners.
View
61 nexus-bootstrap/pom.xml
@@ -1,61 +0,0 @@
-<!--
-
- Sonatype Nexus (TM) Open Source Version
- Copyright (c) 2007-2013 Sonatype, Inc.
- All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-
- This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-
- Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- Eclipse Foundation. All other trademarks are the property of their respective owners.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.sonatype.nexus</groupId>
- <artifactId>nexus</artifactId>
- <version>2.5.0-SNAPSHOT</version>
- </parent>
-
- <artifactId>nexus-bootstrap</artifactId>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.sonatype.appcontext</groupId>
- <artifactId>appcontext</artifactId>
- </dependency>
-
- <dependency>
- <groupId>org.sonatype.sisu</groupId>
- <artifactId>sisu-jetty8</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.yammer.metrics</groupId>
- <artifactId>metrics-jetty</artifactId>
- </dependency>
-
- <dependency>
- <groupId>tanukisoft</groupId>
- <artifactId>wrapper</artifactId>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.sonatype.nexus</groupId>
- <artifactId>nexus-test-common</artifactId>
- <scope>test</scope>
- </dependency>
- </dependencies>
-
-</project>
View
330 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/Launcher.java
@@ -1,330 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap;
-
-import org.eclipse.jetty.util.resource.Resource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.sonatype.appcontext.AppContext;
-import org.sonatype.appcontext.AppContextRequest;
-import org.sonatype.appcontext.Factory;
-import org.sonatype.appcontext.publisher.AbstractStringDumpingEntryPublisher;
-import org.sonatype.appcontext.publisher.SystemPropertiesEntryPublisher;
-import org.sonatype.appcontext.source.PropertiesEntrySource;
-import org.sonatype.appcontext.source.StaticEntrySource;
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-import org.sonatype.nexus.bootstrap.monitor.KeepAliveThread;
-import org.sonatype.nexus.bootstrap.monitor.commands.ExitCommand;
-import org.sonatype.nexus.bootstrap.monitor.commands.HaltCommand;
-import org.sonatype.nexus.bootstrap.monitor.commands.PingCommand;
-import org.sonatype.nexus.bootstrap.monitor.commands.StopApplicationCommand;
-import org.sonatype.sisu.jetty.Jetty8;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.Arrays;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread.LOCALHOST;
-import static org.sonatype.nexus.bootstrap.monitor.KeepAliveThread.KEEP_ALIVE_PING_INTERVAL;
-import static org.sonatype.nexus.bootstrap.monitor.KeepAliveThread.KEEP_ALIVE_PORT;
-import static org.sonatype.nexus.bootstrap.monitor.KeepAliveThread.KEEP_ALIVE_TIMEOUT;
-
-/**
- * Nexus bootstrap launcher.
- *
- * @since 2.1
- */
-public class Launcher
-{
-
- protected final Logger log;
-
- public static final String COMMAND_MONITOR_PORT = CommandMonitorThread.class.getName() + ".port";
-
- public static final String FIVE_SECONDS = "5000";
-
- public static final String ONE_SECOND = "1000";
-
- protected static final String BUNDLEBASEDIR_KEY = "bundleBasedir";
-
- protected static final String JAVA_IO_TMPDIR = "java.io.tmpdir";
-
- protected static final String NEXUS_WORK = "nexus-work";
-
- protected Jetty8 server;
-
- protected Launcher() {
- Logger log = createLogger();
- if (log == null) {
- throw new NullPointerException();
- }
- this.log = log;
- }
-
- protected Logger createLogger() {
- return LoggerFactory.getLogger(getClass());
- }
-
- public Integer start(final String[] args) throws Exception {
- if (args.length != 1) {
- log.error("Missing Jetty configuration file parameter");
- return 1; // exit
- }
-
- AppContext context = createAppContext();
-
- server = new Jetty8(new File(args[0]), context);
-
- ensureTmpDirSanity();
- maybeEnableCommandMonitor();
- maybeEnableShutdownIfNotAlive();
-
- server.startJetty();
- return null; // continue running
- }
-
- /**
- * We have three properties file:
- *
- * default.properties -- embedded in this jar (not user editable)
- * this is the place to set java.io.tmp and debug options by users
- *
- * nexus.properties -- mandatory, will be picked up into context
- * this is place to set nexus properties like workdir location etc (as today)
- *
- * nexus-test.properties -- optional, if present, will override values from those above
- * this is place to set test properties (like jetty port) etc
- *
- * We push the whole app context into system properties, so that nexus[-test].properties
- * can be used to set any system properties (java.io.tmpdir, etc).
- */
- private AppContext createAppContext() throws Exception {
- File cwd = new File(".").getCanonicalFile();
- log.info("Current directory: {}", cwd);
-
- // create app context request, with ID "nexus", without parent, and due to NEXUS-4520 add "plexus" alias too
- final AppContextRequest request = Factory.getDefaultRequest("nexus", null, Arrays.asList("plexus"));
-
- // Kill the default logging publisher that is installed
- request.getPublishers().clear();
-
- // NOTE: sources list is "ascending by importance", 1st elem in list is "weakest" and last elem in list is
- // "strongest" (overrides). Factory already created us some sources, so we are just adding to that list without
- // disturbing the order of the list (we add to list head and tail)
-
- // Add the defaults as least important, is mandatory to be present
- addProperties(request, "defaults", "default.properties", true);
-
- // NOTE: These are loaded as resources, and its expected that <install>/conf is included in the classpath
-
- // Add the nexus.properties, is mandatory to be present
- addProperties(request, "nexus", "/nexus.properties", true);
-
- // Add the nexus-test.properties, not mandatory to be present
- addProperties(request, "nexus-test", "/nexus-test.properties", false);
-
- // Ultimate source of "bundleBasedir" (hence, is added as last in sources list)
- // Now, that will be always overridden by value got from cwd and that seems correct to me
- request.getSources().add(new StaticEntrySource(BUNDLEBASEDIR_KEY, cwd.getAbsolutePath()));
-
- // Install a publisher which will only log as TRACE (default version will log as DEBUG or INFO or WARN)
- request.getPublishers().add(new AbstractStringDumpingEntryPublisher()
- {
- @Override
- public void publishEntries(final AppContext context) {
- if (log.isTraceEnabled()) {
- String dump = getDumpAsString(context);
- log.trace("\n" + dump);
- }
- }
- });
-
- // we need to publish all entries coming from loaded properties
- request.getPublishers().add(new SystemPropertiesEntryPublisher(true));
-
- // create the context and use it as "parent" for Jetty8
- // when context created, the context is built and all publisher were invoked (system props set for example)
- AppContext context = Factory.create(request);
-
- // Make some entries canonical
- canonicalizeEntry(context, NEXUS_WORK);
-
- if (log.isDebugEnabled()) {
- log.debug("Context:");
- for (Map.Entry<String,Object> entry : context.flatten().entrySet()) {
- log.debug(" {}='{}'", entry.getKey(), entry.getValue());
- }
- }
-
- return context;
- }
-
- protected void canonicalizeEntry(final AppContext context, final String key) throws IOException {
- if (!context.containsKey(key)) {
- log.warn("Unable to canonicalize missing entry: {}, key");
- return;
- }
- String value = String.valueOf(context.get(key));
- File file = new File(value).getCanonicalFile();
- value = file.getAbsolutePath();
- context.put(key, value);
- }
-
- protected Properties loadProperties(final Resource resource) throws IOException {
- assert resource != null;
- log.debug("Loading properties from: {}", resource);
- Properties props = new Properties();
- InputStream input = resource.getInputStream();
- try {
- props.load(input);
- if (log.isDebugEnabled()) {
- for (Map.Entry<Object, Object> entry : props.entrySet()) {
- log.debug(" {}='{}'", entry.getKey(), entry.getValue());
- }
- }
- }
- finally {
- input.close();
- }
- return props;
- }
-
- protected URL getResource(final String name) {
- // Now that Launcher is extend-able we'll need to load resources from common package
- return Launcher.class.getResource(name);
- }
-
- protected Properties loadProperties(final String resource, final boolean required) throws IOException {
- URL url = getResource( resource );
- if (url == null) {
- if (required) {
- log.error("Missing resource: {}", resource);
- throw new IOException("Missing resource: " + resource);
- }
- else {
- log.debug("Missing optional resource: {}", resource);
- }
- return null;
- }
- else {
- return loadProperties(Resource.newResource(url));
- }
- }
-
- protected void addProperties(final AppContextRequest request, final String name, final String resource, final boolean required) throws IOException {
- Properties props = loadProperties(resource, required);
- if (props != null) {
- request.getSources().add(new PropertiesEntrySource(name, props));
- }
- }
-
- protected void ensureTmpDirSanity() throws IOException {
- // Make sure that java.io.tmpdir points to a real directory
- String tmp = System.getProperty(JAVA_IO_TMPDIR, "tmp");
- File dir = new File(tmp).getCanonicalFile();
- log.info("Temp directory: {}", dir);
-
- if (!dir.exists()) {
- if (dir.mkdirs()) {
- log.debug("Created tmp dir: {}", dir);
- }
- }
- else if (!dir.isDirectory()) {
- log.warn("Tmp dir is configured to a location which is not a directory: {}", dir);
- }
-
- // Ensure we can actually create a new tmp file
- File file = File.createTempFile("nexus-launcher", ".tmp");
- file.createNewFile();
- file.delete();
-
- System.setProperty(JAVA_IO_TMPDIR, dir.getAbsolutePath());
- }
-
- protected void maybeEnableCommandMonitor() throws IOException {
- String commandMonitorPort = System.getProperty( COMMAND_MONITOR_PORT );
- if ( commandMonitorPort == null )
- {
- commandMonitorPort = System.getenv( COMMAND_MONITOR_PORT );
- }
- if (commandMonitorPort != null) {
- new CommandMonitorThread(
- Integer.parseInt( commandMonitorPort ),
- new StopApplicationCommand( new Runnable()
- {
- @Override
- public void run()
- {
- Launcher.this.commandStop();
- }
- } ),
- new PingCommand(),
- new ExitCommand(),
- new HaltCommand()
- ).start();
- }
- }
-
- protected void maybeEnableShutdownIfNotAlive()
- throws IOException
- {
- String port = System.getProperty( KEEP_ALIVE_PORT );
- if ( port == null )
- {
- port = System.getenv( KEEP_ALIVE_PORT );
- }
- if ( port != null )
- {
- String pingInterval = System.getProperty( KEEP_ALIVE_PING_INTERVAL );
- if ( pingInterval == null )
- {
- pingInterval = System.getenv( KEEP_ALIVE_PING_INTERVAL );
- if ( pingInterval == null )
- {
- pingInterval = FIVE_SECONDS;
- }
- }
- String timeout = System.getProperty( KEEP_ALIVE_TIMEOUT );
- if ( timeout == null )
- {
- timeout = System.getenv( KEEP_ALIVE_TIMEOUT );
- if ( timeout == null )
- {
- timeout = ONE_SECOND;
- }
- }
- new KeepAliveThread(
- LOCALHOST,
- Integer.parseInt( port ),
- Integer.parseInt( pingInterval ),
- Integer.parseInt( timeout )
- ).start();
- }
- }
-
- public void commandStop() {
- ShutdownHelper.exit(0);
- }
-
- public void stop() throws Exception {
- server.stopJetty();
- }
-
- public static void main(final String[] args) throws Exception {
- new Launcher().start(args);
- }
-}
View
66 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/ShutdownHelper.java
@@ -1,66 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap;
-
-/**
- * Helper to cope with different mechanisms to shtudown.
- *
- * @since 2.2
- */
-public class ShutdownHelper
-{
- public static interface ShutdownDelegate
- {
- void doExit(int code);
-
- void doHalt(int code);
- }
-
- public static class JavaShutdownDelegate
- implements ShutdownDelegate
- {
- @Override
- public void doExit(final int code) {
- System.exit(code);
- }
-
- @Override
- public void doHalt(final int code) {
- Runtime.getRuntime().halt(code);
- }
- }
-
- private static ShutdownDelegate delegate = new JavaShutdownDelegate();
-
- public static ShutdownDelegate getDelegate() {
- if (delegate == null) {
- throw new IllegalStateException();
- }
- return delegate;
- }
-
- public static void setDelegate(final ShutdownDelegate delegate) {
- if (delegate == null) {
- throw new NullPointerException();
- }
- ShutdownHelper.delegate = delegate;
- }
-
- public static void exit(final int code) {
- getDelegate().doExit(code);
- }
-
- public static void halt(final int code) {
- getDelegate().doHalt(code);
- }
-}
View
111 .../src/main/java/org/sonatype/nexus/bootstrap/jetty/InstrumentedSelectChannelConnector.java
@@ -1,111 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.jetty;
-
-import com.yammer.metrics.Metrics;
-import com.yammer.metrics.core.Counter;
-import com.yammer.metrics.core.Meter;
-import com.yammer.metrics.core.MetricsRegistry;
-import com.yammer.metrics.core.Timer;
-import org.eclipse.jetty.io.Connection;
-import org.eclipse.jetty.server.nio.SelectChannelConnector;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Custom re-implementation of {@link com.yammer.metrics.jetty.InstrumentedSelectChannelConnector}
- * which sets up metrics collection on {@link #doStart()} instead of in CTOR.
- *
- * @since 2.5
- */
-public final class InstrumentedSelectChannelConnector
- extends SelectChannelConnector
-{
- private static final Logger log = LoggerFactory.getLogger(InstrumentedSelectChannelConnector.class);
-
- private final MetricsRegistry registry;
-
- private Timer duration;
-
- private Meter accepts, connects, disconnects;
-
- private Counter connections;
-
- public InstrumentedSelectChannelConnector() {
- registry = Metrics.defaultRegistry();
- }
-
- @Override
- protected void doStart() throws Exception {
- String port = String.valueOf(getPort());
-
- this.duration = registry.newTimer(SelectChannelConnector.class,
- "connection-duration",
- port,
- TimeUnit.MILLISECONDS,
- TimeUnit.SECONDS);
-
- this.accepts = registry.newMeter(SelectChannelConnector.class,
- "accepts",
- port,
- "connections",
- TimeUnit.SECONDS);
-
- this.connects = registry.newMeter(SelectChannelConnector.class,
- "connects",
- port,
- "connections",
- TimeUnit.SECONDS);
-
- this.disconnects = registry.newMeter(SelectChannelConnector.class,
- "disconnects",
- port,
- "connections",
- TimeUnit.SECONDS);
-
- this.connections = registry.newCounter(SelectChannelConnector.class,
- "active-connections",
- port);
-
- log.info("Metrics enabled");
-
- super.doStart();
- }
-
- // TODO: remove metrics on doStop()
-
- @Override
- public void accept(final int acceptorID) throws IOException {
- super.accept(acceptorID);
- accepts.mark();
- }
-
- @Override
- protected void connectionOpened(final Connection connection) {
- connections.inc();
- super.connectionOpened(connection);
- connects.mark();
- }
-
- @Override
- protected void connectionClosed(final Connection connection) {
- super.connectionClosed(connection);
- disconnects.mark();
- final long duration = System.currentTimeMillis() - connection.getTimeStamp();
- this.duration.update(duration, TimeUnit.MILLISECONDS);
- connections.dec();
- }
-}
View
81 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/JswLauncher.java
@@ -1,81 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.jsw;
-
-import org.slf4j.Logger;
-import org.sonatype.nexus.bootstrap.Launcher;
-import org.sonatype.nexus.bootstrap.ShutdownHelper;
-import org.tanukisoftware.wrapper.WrapperManager;
-
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_CTRL_LOGOFF_EVENT;
-
-/**
- * JSW adapter for {@link Launcher}.
- *
- * @since 2.1
- */
-public class JswLauncher
- extends WrapperListenerSupport
-{
- private final Launcher launcher;
-
- public JswLauncher() {
- this.launcher = new Launcher()
- {
- @Override
- protected Logger createLogger() {
- return JswLauncher.this.log;
- }
-
- @Override
- public void commandStop() {
- WrapperManager.stopAndReturn(0);
- }
-
- };
- }
-
- @Override
- protected Integer doStart(final String[] args) throws Exception {
- if (WrapperManager.isControlledByNativeWrapper()) {
- log.info("JVM ID: {}, JVM PID: {}, Wrapper PID: {}, User: {}",
- WrapperManager.getJVMId(), WrapperManager.getJavaPID(), WrapperManager.getWrapperPID(),
- WrapperManager.getUser(false).getUser() );
- }
-
- return launcher.start(args);
- }
-
- @Override
- protected int doStop(final int code) throws Exception {
- launcher.stop();
- return code;
- }
-
- @Override
- protected void doControlEvent(final int code) {
- if (WRAPPER_CTRL_LOGOFF_EVENT == code && WrapperManager.isLaunchedAsService()) {
- log.debug("Launched as a service; ignoring event: {}", code);
- }
- else {
- log.debug("Stopping");
- WrapperManager.stop(0);
- throw new Error("unreachable");
- }
- }
-
- public static void main(final String[] args) throws Exception {
- ShutdownHelper.setDelegate(new JswShutdownDelegate());
- WrapperManager.start(new JswLauncher(), args);
- }
-}
View
35 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/JswShutdownDelegate.java
@@ -1,35 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.jsw;
-
-import org.sonatype.nexus.bootstrap.ShutdownHelper.ShutdownDelegate;
-import org.tanukisoftware.wrapper.WrapperManager;
-
-/**
- * JSW {@link ShutdownDelegate}.
- *
- * @since 2.2
- */
-public class JswShutdownDelegate
- implements ShutdownDelegate
-{
- @Override
- public void doExit(final int code) {
- WrapperManager.stop(code);
- }
-
- @Override
- public void doHalt(final int code) {
- WrapperManager.stopImmediate(code);
- }
-}
View
74 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/WrapperListenerSupport.java
@@ -1,74 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.jsw;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.tanukisoftware.wrapper.WrapperListener;
-
-import java.util.Arrays;
-
-/**
- * Support for {@link WrapperListener} implementations.
- *
- * @since 2.1
- */
-public abstract class WrapperListenerSupport
- implements WrapperListener
-{
- protected final Logger log = LoggerFactory.getLogger(getClass());
-
- @Override
- public Integer start(final String[] args) {
- log.info("Starting with arguments: {}", Arrays.asList(args));
-
- try {
- return doStart(args);
- }
- catch (Exception e) {
- log.error("Failed to start", e);
- return 1; // exit
- }
- }
-
- protected abstract Integer doStart(final String[] args) throws Exception;
-
- @Override
- public int stop(final int code) {
- log.info("Stopping with code: {}", code);
-
- try {
- return doStop(code);
- }
- catch (Exception e) {
- log.error("Failed to stop cleanly", e);
- return 1; // exit
- }
- }
-
- protected abstract int doStop(final int code) throws Exception;
-
- @Override
- public void controlEvent(final int code) {
- log.info("Received control event: {}", code);
-
- try {
- doControlEvent(code);
- }
- catch (Exception e) {
- log.error("Failed to handle control event[{}]", code, e);
- }
- }
-
- protected abstract void doControlEvent(final int code) throws Exception;
-}
View
68 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/jsw/WrapperLog.java
@@ -1,68 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.jsw;
-
-import org.tanukisoftware.wrapper.WrapperManager;
-
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_ADVICE;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_DEBUG;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_ERROR;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_FATAL;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_INFO;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_STATUS;
-import static org.tanukisoftware.wrapper.WrapperManager.WRAPPER_LOG_LEVEL_WARN;
-
-/**
- * Helper to emit messages via the JSW wrapper log stream.
- *
- * @since 2.1
- */
-public class WrapperLog
-{
- public static void log(final int level, final String message) {
- WrapperManager.log(level, message);
- }
-
- public static void debug(final String message) {
- log(WRAPPER_LOG_LEVEL_DEBUG, message);
- }
-
- public static void info(final String message) {
- log(WRAPPER_LOG_LEVEL_INFO, message);
- }
-
- public static void status(final String message) {
- log(WRAPPER_LOG_LEVEL_STATUS, message);
- }
-
- public static void warn(final String message) {
- log(WRAPPER_LOG_LEVEL_WARN, message);
- }
-
- public static void error(final String message) {
- log(WRAPPER_LOG_LEVEL_ERROR, message);
- }
-
- public static void fatal(final String message) {
- log(WRAPPER_LOG_LEVEL_FATAL, message);
- }
-
- public static void fatal(final String message, final Throwable cause) {
- log(WRAPPER_LOG_LEVEL_FATAL, message);
- cause.printStackTrace();
- }
-
- public static void advice(final String message) {
- log(WRAPPER_LOG_LEVEL_ADVICE, message);
- }
-}
View
61 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/LogProxy.java
@@ -1,61 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.log;
-
-/**
- * A log proxy allowing redirecting output (e.g. in case that there is no slf4j available).
- *
- * @since 2.2
- */
-public class LogProxy
-{
-
- public void debug( final String message, Object... args )
- {
- // does nothing
- }
-
- public void info( final String message, final Object... args )
- {
- // does nothing
- }
-
- public void error( final String message, Object... args )
- {
- // does nothing
- }
-
- public void error( final String message, Throwable e )
- {
- // does nothing
- }
-
- public void warn( final String message, Object... args )
- {
- // does nothing
- }
-
- public static LogProxy getLogger( final Class clazz )
- {
- try
- {
- LogProxy.class.getClassLoader().loadClass( "org.slf4j.Logger" );
- return new Slf4jLogProxy( clazz );
- }
- catch ( ClassNotFoundException e )
- {
- return new SystemOutLogProxy( clazz );
- }
- }
-
-}
View
69 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/Slf4jLogProxy.java
@@ -1,69 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.log;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Logs to SLF4J.
- *
- * @since 2.2
- */
-public class Slf4jLogProxy
- extends LogProxy
-{
-
- private Logger log = LoggerFactory.getLogger( this.getClass() );
-
- public Slf4jLogProxy( final Logger log )
- {
- this.log = log;
- }
-
- public Slf4jLogProxy( final Class clazz )
- {
- this( LoggerFactory.getLogger( clazz ) );
- }
-
- @Override
- public void debug( final String message, Object... args )
- {
- log.debug( message, args );
- }
-
- @Override
- public void info( final String message, final Object... args )
- {
- log.info( message, args );
- }
-
- @Override
- public void error( final String message, Object... args )
- {
- log.error( message, args );
- }
-
- @Override
- public void error( final String message, Throwable e )
- {
- log.error( message, e );
- }
-
- @Override
- public void warn( final String message, Object... args )
- {
- log.warn( message, args );
- }
-
-}
View
74 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/log/SystemOutLogProxy.java
@@ -1,74 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.log;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Logs to System.out.
- *
- * @since 2.2
- */
-public class SystemOutLogProxy
- extends LogProxy
-{
-
- private Class clazz;
-
- public SystemOutLogProxy( final Class clazz )
- {
- this.clazz = clazz;
- }
-
- @Override
- public void debug( final String message, Object... args )
- {
- message( "DEBUG", message, args );
- }
-
- @Override
- public void info( final String message, final Object... args )
- {
- message( "INFO", message, args );
- }
-
- @Override
- public void error( final String message, final Throwable e )
- {
- error( message );
- e.printStackTrace( System.out );
- }
-
- @Override
- public void error( final String message, Object... args )
- {
- message( "ERROR", message, args );
- }
-
- @Override
- public void warn( final String message, Object... args )
- {
- message( "WARN", message, args );
- }
-
- private void message( final String level, final String message, Object... args )
- {
- final String timestamp = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss" ).format( new Date() );
- System.out.println(
- timestamp + " [" + level + "] " + clazz.getSimpleName()
- + " - " + String.format( message.replace( "{}", "%s" ), args )
- );
- }
-
-}
View
136 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/CommandMonitorTalker.java
@@ -1,136 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor;
-
-import java.io.OutputStream;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-
-import org.sonatype.nexus.bootstrap.log.LogProxy;
-
-/**
- * Talks to the command monitor.
- *
- * @since 2.1
- */
-public class CommandMonitorTalker
-{
-
- /**
- * Logger. Uses log proxy to be able to redirect log output to System.out if SLF4J is not available (Nexus < 2.1).
- */
- private static LogProxy log = LogProxy.getLogger( CommandMonitorTalker.class );
-
- /**
- * 5 seconds in milliseconds. Used as default timeout.
- */
- private static final int FIVE_SECONDS = 5000;
-
- /**
- * Host to send commands to.
- * Never null.
- */
- private final String host;
-
- /**
- * Port on host to send commands to.
- * Bigger then 1.
- */
- private final int port;
-
- /**
- * Constructor.
- *
- * @param host to send commands to. Cannot be null.
- * @param port on host to send commands to. Must be bigger then 1.
- */
- public CommandMonitorTalker( final String host, final int port )
- {
- if ( host == null )
- {
- throw new NullPointerException();
- }
- this.host = host;
- if ( port < 1 )
- {
- throw new IllegalArgumentException( "Invalid port" );
- }
- this.port = port;
- }
-
- /**
- * Sends a command to a {@link CommandMonitorThread} on configured host/port.
- *
- * @param command to send. Cannot be null.
- * @throws Exception Re-thrown if sending command fails
- */
- public void send( final String command )
- throws Exception
- {
- send( command, FIVE_SECONDS );
- }
-
- /**
- * Sends a command to a {@link CommandMonitorThread} on configured host/port, timing out after the specified number
- * of milliseconds.
- *
- * @param command to send. Cannot be null.
- * @param timeout number of milliseconds after which sending the command should timeout
- * @throws Exception Re-thrown if sending command fails
- */
- public void send( final String command, final int timeout )
- throws Exception
- {
- if ( command == null )
- {
- throw new NullPointerException();
- }
-
- log.debug( "Sending command: {}", command );
-
- Socket socket = new Socket();
- socket.setSoTimeout( timeout );
- socket.connect( new InetSocketAddress( host, port ) );
- try
- {
- OutputStream output = socket.getOutputStream();
- output.write( command.getBytes() );
- output.close();
- }
- finally
- {
- socket.close();
- }
- }
-
- /**
- * Returns the host to send commands to.
- *
- * @return host to send commands to. Never null.
- */
- public String getHost()
- {
- return host;
- }
-
- /**
- * Returns the port on host to send commands to.
- *
- * @return port on host to send commands to. Bigger then 1.
- */
- public String getPort()
- {
- return host;
- }
-
-}
View
172 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/CommandMonitorThread.java
@@ -1,172 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.InetAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.sonatype.nexus.bootstrap.log.LogProxy;
-import org.sonatype.nexus.bootstrap.monitor.commands.PingCommand;
-
-/**
- * Thread which listens for command messages and executes them if they match one of available commands.
- *
- * @since 2.1
- */
-public class CommandMonitorThread
- extends Thread
-{
-
- /**
- * Local host IP (127.0.0.1).
- */
- public static final String LOCALHOST = "127.0.0.1";
-
- /**
- * Logger. Uses log proxy to be able to redirect log output to System.out if SLF4J is not available (Nexus < 2.1).
- */
- private static final LogProxy log = LogProxy.getLogger( CommandMonitorThread.class );
-
- /**
- * Listening socket.
- * Never null.
- */
- private final ServerSocket socket;
-
- /**
- * List of available commands.
- */
- private final Map<String, Command> commands = new HashMap<String, Command>();
-
- /**
- * Constructor.
- *
- * @param port port on which to listen for commands. If zero, an random port will be chosen.
- * @param commands available commands. Can be empty.
- * @throws IOException Re-thrown while opening listening socket
- */
- public CommandMonitorThread( final int port, final Command... commands )
- throws IOException
- {
- setDaemon( true );
-
- if ( commands != null )
- {
- for ( final Command command : commands )
- {
- this.commands.put( command.getId(), command );
- }
- }
-
- setDaemon( true );
- setName( "Bootstrap Command Monitor" );
-
- // Only listen on local interface
- this.socket = new ServerSocket( port, 1, InetAddress.getByName( LOCALHOST ) );
- }
-
- /**
- * Listens for commands on configured port on local interface.
- */
- @Override
- public void run()
- {
- log.debug( "Listening for commands: {}", socket );
-
- boolean running = true;
- while ( running )
- {
- try
- {
- Socket client = socket.accept();
- log.debug( "Accepted client: {}", client );
-
- BufferedReader reader = new BufferedReader( new InputStreamReader( client.getInputStream() ) );
- String commandId = reader.readLine();
- log.debug( "Read command: {}", commandId );
- client.close();
-
- if ( commandId == null )
- {
- commandId = PingCommand.NAME;
- }
- final Command command = commands.get( commandId );
- if ( command == null )
- {
- log.error( "Unknown command: {}", commandId );
- }
- else
- {
- running = !command.execute();
- }
- }
- catch ( Exception e )
- {
- log.error( "Failed", e );
- }
- }
-
- try
- {
- socket.close();
- }
- catch ( IOException e )
- {
- // ignore
- }
-
- log.debug( "Stopped" );
- }
-
- /**
- * Returns the port, the monitor, it listens to. Is the provided one or the random generated one if port used in
- * constructor was null.
- *
- * @return monitor port. Bigger then 0.
- */
- public int getPort()
- {
- return socket.getLocalPort();
- }
-
- /**
- * A command to be executed in case that received command matches.
- *
- * @since 2.2
- */
- public static interface Command
- {
-
- /**
- * ID of command (when it should be executed).
- *
- * @return command id. Never null.
- */
- String getId();
-
- /**
- * Executes the command.
- *
- * @return true, if command monitor thread should stop running
- */
- boolean execute();
-
- }
-
-}
View
149 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/KeepAliveThread.java
@@ -1,149 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor;
-
-import org.sonatype.nexus.bootstrap.ShutdownHelper;
-import org.sonatype.nexus.bootstrap.monitor.commands.PingCommand;
-
-import java.io.IOException;
-import java.net.ConnectException;
-
-/**
- * Thread which pings a specified host:port at a configured interval and executes a task if
- * the remote monitor is unreachable (ie. {@link ConnectException}).
- *
- * @since 2.2
- */
-public class KeepAliveThread
- extends Thread
-{
- // NOTE: Avoiding any logging our sysout usage by this class, this could lockup logging when its detected remote unreachable
-
- public static final String KEEP_ALIVE_PORT = KeepAliveThread.class.getName() + ".port";
-
- public static final String KEEP_ALIVE_PING_INTERVAL = KeepAliveThread.class.getName() + ".pingInterval";
-
- public static final String KEEP_ALIVE_TIMEOUT = KeepAliveThread.class.getName() + ".timeout";
-
- private final CommandMonitorTalker talker;
-
- private final int interval;
-
- private final int timeout;
-
- private final Runnable task;
-
- private volatile boolean running;
-
- /**
- * Execute custom {@link Runtime} when remote is unreachable.
- *
- * @param host host to be pinged
- * @param port port on host to be pinged
- * @param interval interval between pings
- * @param timeout ping timeout
- * @param task task to execute when remote is unreachable, this task should not log or write to syslog if possible to avoid locking up on shutdown
- */
- // TestAccessible for most uses the task should be to HALT
- public KeepAliveThread(final String host,
- final int port,
- final int interval,
- final int timeout,
- final Runnable task)
- throws IOException
- {
- setDaemon(true);
- setName(getClass().getName());
-
- this.talker = new CommandMonitorTalker(host, port);
- this.interval = interval;
- this.timeout = timeout;
- this.task = task;
- this.running = true;
- }
-
- /**
- * Halt the JVM when remote is unreachable.
- *
- * @param host host to be pinged
- * @param port port on host to be pinged
- * @param interval interval between pings
- * @param timeout ping timeout
- */
- public KeepAliveThread(final String host,
- final int port,
- final int interval,
- final int timeout)
- throws IOException
- {
- this(host, port, interval, timeout, new Runnable()
- {
- @Override
- public void run() {
- ShutdownHelper.halt(666);
- }
- });
- }
-
- /**
- * Continue pinging on configured port until there is a connection (refused) exception, case when a shutdown will be performed.
- */
- @Override
- public void run() {
- while (running) {
- try {
- try {
- ping();
- sleep(interval);
- }
- catch (final InterruptedException e) {
- // re-ping if we were interrupted for any reason
- ping();
- }
- }
- catch (ConnectException e) {
- stopRunning();
- executeTask();
- }
- }
- }
-
- /**
- * Pings the configured host/port.
- *
- * @throws ConnectException If ping fails
- */
- private void ping() throws ConnectException {
- try {
- talker.send(PingCommand.NAME, timeout);
- }
- catch (ConnectException e) {
- throw e;
- }
- catch (Exception e) {
- // ignore
- }
- }
-
- // @TestAccessible
- void executeTask() {
- task.run();
- }
-
- /**
- * Stops this thread from running (without running the shutdown code).
- */
- public void stopRunning() {
- running = false;
- }
-}
View
43 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/ExitCommand.java
@@ -1,43 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor.commands;
-
-import org.sonatype.nexus.bootstrap.ShutdownHelper;
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-
-/**
- * Command to exit the JVM (via {@link ShutdownHelper#exit(int)}).
- *
- * @since 2.2
- */
-public class ExitCommand
- implements CommandMonitorThread.Command
-{
-
- public static final String NAME = "EXIT";
-
- @Override
- public String getId()
- {
- return NAME;
- }
-
- @Override
- public boolean execute()
- {
- ShutdownHelper.exit(666);
-
- throw new Error("Unreachable statement");
- }
-
-}
View
43 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/HaltCommand.java
@@ -1,43 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor.commands;
-
-import org.sonatype.nexus.bootstrap.ShutdownHelper;
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-
-/**
- * Command to forcibly halt the JVM (via {@link ShutdownHelper#halt(int)}).
- *
- * @since 2.2
- */
-public class HaltCommand
- implements CommandMonitorThread.Command
-{
-
- public static final String NAME = "HALT";
-
- @Override
- public String getId()
- {
- return NAME;
- }
-
- @Override
- public boolean execute()
- {
- ShutdownHelper.halt(666);
-
- throw new Error("Unreachable statement");
- }
-
-}
View
44 nexus-bootstrap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/PingCommand.java
@@ -1,44 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor.commands;
-
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-import org.sonatype.nexus.bootstrap.log.LogProxy;
-
-/**
- * Responds to pings (by doing nothing).
- *
- * @since 2.2
- */
-public class PingCommand
- implements CommandMonitorThread.Command
-{
-
- private static final LogProxy log = LogProxy.getLogger( PingCommand.class );
-
- public static final String NAME = "PING";
-
- @Override
- public String getId()
- {
- return NAME;
- }
-
- @Override
- public boolean execute()
- {
- log.debug( "Pinged" );
- return false;
- }
-
-}
View
58 ...p/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/StopApplicationCommand.java
@@ -1,58 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor.commands;
-
-import org.sonatype.nexus.bootstrap.log.LogProxy;
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-
-/**
- * Stop launcher.
- *
- * @since 2.2
- */
-public class StopApplicationCommand
- implements CommandMonitorThread.Command
-{
-
- private static final LogProxy log = LogProxy.getLogger( StopApplicationCommand.class );
-
- public static final String NAME = "STOP";
-
- private final Runnable shutdown;
-
- public StopApplicationCommand( final Runnable shutdown )
- {
- if ( shutdown == null )
- {
- throw new NullPointerException();
- }
- this.shutdown = shutdown;
- }
-
- @Override
- public String getId()
- {
- return NAME;
- }
-
- @Override
- public boolean execute()
- {
- log.debug( "Requesting application stop" );
- shutdown.run();
-
- // Do not terminate the monitor on application stop, leave that to the jvm death
- return false;
- }
-
-}
View
44 ...strap/src/main/java/org/sonatype/nexus/bootstrap/monitor/commands/StopMonitorCommand.java
@@ -1,44 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor.commands;
-
-import org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread;
-import org.sonatype.nexus.bootstrap.log.LogProxy;
-
-/**
- * Stops command monitor.
- *
- * @since 2.2
- */
-public class StopMonitorCommand
- implements CommandMonitorThread.Command
-{
-
- private static final LogProxy log = LogProxy.getLogger( StopMonitorCommand.class );
-
- public static final String NAME = "STOP_MONITOR";
-
- @Override
- public String getId()
- {
- return NAME;
- }
-
- @Override
- public boolean execute()
- {
- log.debug( "Requesting monitor stop" );
- return true;
- }
-
-}
View
18 nexus-bootstrap/src/main/resources/org/sonatype/nexus/bootstrap/default.properties
@@ -1,18 +0,0 @@
-#
-# Sonatype Nexus (TM) Open Source Version
-# Copyright (c) 2007-2013 Sonatype, Inc.
-# All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-#
-# This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
-# which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-#
-# Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
-# of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
-# Eclipse Foundation. All other trademarks are the property of their respective owners.
-#
-
-java.awt.headless=true
-java.io.tmpdir=${nexus-work}/tmp
-networkaddress.cache.ttl=3600
-org.eclipse.ecf.provider.filetransfer.retrieve.readTimeout=30000
-jettyPlexusCompatibility=true
View
73 nexus-bootstrap/src/test/java/org/sonatype/nexus/bootstrap/monitor/KeepAliveThreadTest.java
@@ -1,73 +0,0 @@
-/*
- * Sonatype Nexus (TM) Open Source Version
- * Copyright (c) 2007-2013 Sonatype, Inc.
- * All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
- *
- * This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- * which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
- *
- * Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- * of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- * Eclipse Foundation. All other trademarks are the property of their respective owners.
- */
-package org.sonatype.nexus.bootstrap.monitor;
-
-import org.junit.Test;
-import org.sonatype.nexus.bootstrap.monitor.commands.PingCommand;
-import org.sonatype.nexus.bootstrap.monitor.commands.StopMonitorCommand;
-import org.sonatype.sisu.litmus.testsupport.TestSupport;
-
-import java.util.concurrent.atomic.AtomicBoolean;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.sonatype.nexus.bootstrap.monitor.CommandMonitorThread.LOCALHOST;
-
-/**
- * Test for {@link KeepAliveThreadTest}.
- *
- * @since 2.2
- */
-public class KeepAliveThreadTest
- extends TestSupport
-{
- @Test
- public void keepAlive()
- throws Exception
- {
- CommandMonitorThread keepAliveThread = new CommandMonitorThread(
- 0,
- new PingCommand(),
- new StopMonitorCommand()
- );
- keepAliveThread.start();
-
- final AtomicBoolean shutDown = new AtomicBoolean(false);
-
- KeepAliveThread thread = new KeepAliveThread(
- LOCALHOST,
- keepAliveThread.getPort(),
- 100,
- 1000,
- new Runnable()
- {
- @Override
- public void run() {
- shutDown.set(true);
- }
- }
- );
- thread.start();
-
- Thread.sleep(2000);
-
- new CommandMonitorTalker(LOCALHOST, keepAliveThread.getPort()).send(StopMonitorCommand.NAME);
- keepAliveThread.join();
-
- thread.interrupt();
- thread.stopRunning();
- thread.join();
-
- assertThat(shutDown.get(), is(true));
- }
-}
View
37 nexus-client-core-testsuite/pom.xml
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Sonatype Nexus (TM) Open Source Version
- Copyright (c) 2007-2013 Sonatype, Inc.
- All rights reserved. Includes the third-party code listed at http://links.sonatype.com/products/nexus/oss/attributions.
-
- This program and the accompanying materials are made available under the terms of the Eclipse Public License Version 1.0,
- which accompanies this distribution and is available at http://www.eclipse.org/legal/epl-v10.html.
-
- Sonatype Nexus (TM) Professional Version is available from Sonatype, Inc. "Sonatype" and "Sonatype Nexus" are trademarks
- of Sonatype, Inc. Apache Maven is a trademark of the Apache Software Foundation. M2eclipse is a trademark of the
- Eclipse Foundation. All other trademarks are the property of their respective owners.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0"