425 Commits

Author SHA1 Message Date
Shawn Pearce
d7ec6703e7 Merge "Add init step for installing the 'Verified' label" 2013-12-22 18:07:47 +00:00
Edwin Kempin
31f2ba05e1 Add init step for installing the 'Verified' label
Change-Id: I508b88b9de73ee6db30482c6c9ec9c3404195241
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-12-21 16:58:23 +01:00
Shawn Pearce
c555134731 Merge "Allow init steps to do initialisation after the site is created" 2013-12-21 04:02:10 +00:00
Dave Borowitz
7547233449 Stop passing ReviewDb, etc. to ChangeData methods
Many methods that are intended for lazy initialization take a
ReviewDb, and some take other helper objects such as
GitRepositoryManager. This achieves the intended lazy-loading behavior
but requires a lot of injection of dependencies into callers, and may
become untenable as lazy loading of ChangeData requires more helpers.

Instead, since after all this is Java, construct ChangeData with a
Factory. This is subtle because it is used from a lot of places that
need control over which ReviewDb handle to pass in, so the factory
methods still need to take a db. ChangeData objects are still intended
(i.e. safe) for use only by one thread, so having a single ReviewDb
instance stored for the lifetime of the ChangeData should be fine. We
just need to be careful about which we pass in, particularly in a
place like ChangeIndexer.

As a side effect, clean up some other injection, particularly in the
predicate class hierarchy.

Change-Id: I52e1eb2a76788c12dd95767e89095ab80df7e1cc
2013-12-20 15:54:18 -08:00
Dave Borowitz
31b599b40f Move "refs/..." constants to a RefNames class
This class lives in gerrit-reviewdb because "refs/changes/" needs to be
referenced from PatchSet in reviewdb/client (and other UI classes).

Rename constants to all use REFS_* instead of being inconsistent.

Change-Id: I76e6ee7e63a4549b51a43698fb50b54a19dabfc6
2013-12-11 12:41:07 -08:00
Shawn Pearce
8bdf12af0b Merge "Add utility class to inspect Guice wiring" 2013-12-04 23:04:04 +00:00
David Ostrovsky
14c433949a Add utility class to inspect Guice wiring
It is known that it is not so easy to troubleshoot Guice wiring problems.
Thankfully the Guice authors added java util logging facility. This change
introduces the Guice logger activator to easily enable/disable Guice logging.

To activate Guice logging add this line to your run() method:

  @Override
  public int run() throws Exception {
    GuiceLogger.enable();
    [...]
  }

Sample output from reindex pgm:
  http://paste.openstack.org/show/54356

Change-Id: Idd0d71e3660d098b593dc9fc7d9147fde49b8a16
2013-12-04 07:56:13 +01:00
alex.ryazantsev
db721d46f0 Replace 'indexOf()' expression with 'contains()'
Change-Id: I10a5ed7c813af7ab40707369bf4c1953c030b10d
2013-12-04 01:15:19 +04:00
Shawn Pearce
9e1c29b49f Merge changes I4b879eeb,If2a048df,Iac31374d,I31603a80
* changes:
  Don't put plugins into system classpath
  Isolate plugin class directories from each other
  Display UI build failures in browser
  Unify debug launch configs and auto-detect browser
2013-12-02 15:35:02 +00:00
Edwin Kempin
fdc4941a88 Allow init steps to do initialisation after the site is created
If an init step wants to modify the project.config file of the
All-Projects project this can only be done after the site has been
created.

The AllProjectsConfig can now be injected even if the site does not
exist yet.

Change-Id: Ic2dd15e1bae2dcca3aba8138f31b99c14bff2a02
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-12-02 15:19:43 +01:00
Shawn Pearce
0bafa60b7a Merge "Revert "Add init step for installing the 'Verified' label"" 2013-12-01 01:24:01 +00:00
Shawn Pearce
aa4e79f548 Revert "Add init step for installing the 'Verified' label"
This reverts commit 0a7f8e79eb9e8d54739d8d3c40dea93e789b5801.
New site initialization is broken with InitLabels in the environment.

Change-Id: Ied28bc2e990f21df20265675afadaef9dae0890d
2013-12-01 01:23:52 +00:00
Shawn Pearce
cdf1580a7d Merge "Add init step for installing the 'Verified' label" 2013-11-30 23:53:13 +00:00
Shawn Pearce
9e4d5aa347 Isolate plugin class directories from each other
Configure Eclipse to compile/copy each plugin's classes and resources
into its own private classes folder.  This should fix the duplicate
resource warnings for about.md or other documentation and static image
assets.

Move test and utility classes into their own directories too. This
has no real impact on the runtime classpath at this time, but opens
the door to do something more creative later.

Change-Id: If2a048dfe0349f671a17f9e80d6f22a69a5c0ade
2013-11-30 13:17:18 -08:00
Shawn Pearce
3ed6b83ec2 Merge "Save GWT compile time by avoiding javac" 2013-11-30 19:24:38 +00:00
Shawn Pearce
05cb053378 Save GWT compile time by avoiding javac
GWT only needs the rebind code for CSS and ServerLinker to be
precompiled as bytecode. Save build time by passing no source
files to the java_library() used by gwt_module().

For a full draft build of ui_safari this cuts the refresh time
down from 32.015s to 26.158s on my MacBook. Saving 6s on each
UI reload adds up during development.

The common annotations need to be provided as bytecode, avoiding
spurious warnings from GWT when there is a Java syntax error.

Change-Id: I37826498650c65c05303e7d4d1177d05781c56f6
2013-11-30 11:06:50 -08:00
David Ostrovsky
c34d3607ba Install open ssl jar into Gerrit site for bouncycastle crypto provider
937d527ac0e4ee685fccb60ae604406a6638daec upgraded bouncy castle to 1.49.

The old JAR artifact was renamed and split to number of files. For Gerrit
two libraries must be downloaded and be available under `$gerrit_site/lib`:

* bcprov-jdk15on-149.jar
* bcpkix-jdk15on-149.jar

Update download logic to support a basic concept of required dependencies,
ensuring BC provider is downloaded if the SSL library is installed by init.

Change-Id: I60092ebe136f78a5649fe8512737275f50195a34
2013-11-30 10:30:43 -08:00
Edwin Kempin
0a7f8e79eb Add init step for installing the 'Verified' label
Change-Id: Ia2a50ebe5719e54588db8652e4fb22ae658ae4da
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-11-30 09:39:56 +01:00
Shawn Pearce
d66e854d6d Merge "Enable plugins on init to read/edit the All-Projects project.config" 2013-11-30 08:27:26 +00:00
Edwin Kempin
d4cfac1cd6 Enable plugins on init to read/edit the All-Projects project.config
Some plugins may store their configuration in the project.config file
of the All-Projects project. The configuration may depend on user
input during the plugin initalization. Plugins are now able to write
configuration parameters into the All-Projects project.config during
an InitStep.

E.g. plugins may provide functionality which should be
enabled/disabled per project, which is reflected by an 'enabled'
parameter in project.config:

  [plugin "myPlugin"]
    enabled = true

If this parameter is not set, the value should be inherited from the
parent project. Having the possibility to edit the All-Projects
project.config on init the user can decide during the plugin
initialization if the functionality should by default be
enabled/disabled for all projects.

Change-Id: I8e240858e0778469c0d511ff380865f317448e15
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-11-30 07:29:26 +01:00
Shawn Pearce
80d9cdbb88 Display UI build failures in browser
Instead of crashing the Jetty daemon when there is a UI build failure,
keep the daemon running and display the output from Buck in the web
browser.  This allows for a slightly quicker fix and retry cycle,
especially for minor typos in ui.xml files.  Simply edit the offending
source and reload, without needing to relaunch the daemon.

Change-Id: Iac31374d4efd44c4c6a58ce08497fbf24dd6dfa9
2013-11-29 18:28:08 -08:00
Shawn Pearce
cda2121828 Unify debug launch configs and auto-detect browser
Use the same permutation selector applied by the server at runtime to
automatically detect the browser making the request and build/refresh
that UI permutation.

Change-Id: I31603a80e23a8e4e2c46325be4dac808d8f98a5c
2013-11-29 18:14:57 -08:00
Shawn Pearce
8dfd959750 Merge changes Ia9a64f77,Icc8e20d8
* changes:
  Fix Daemon start when sshd.listenAddress=off and host key doesn't exist
  Remove unreachable code in Daemon.createSshInjector
2013-11-29 23:49:06 +00:00
Shawn Pearce
e14f734c16 Merge "Remove TrackingIds table from SQL database" 2013-11-29 21:10:09 +00:00
Shawn Pearce
f920760278 Merge "Bump bouncycastle verison to 1.49" 2013-11-29 21:05:22 +00:00
Shawn Pearce
9f4de526dd Remove TrackingIds table from SQL database
This table is not necessary with the secondary index enabled.

Change-Id: I87820c638cf69e688f9aa95edf190a8c56138a0b
2013-11-29 13:04:37 -08:00
Shawn Pearce
da07edd370 Merge "Delete SQL index support" 2013-11-29 20:48:26 +00:00
Shawn Pearce
d4ae3a16d5 Delete SQL index support
Require the secondary index to be enabled in Gerrit 2.9.  Unless
configured differently, Lucene is used for the secondary index.

Change-Id: I3d2d804170835d69ffbfef586ddc3873ea3cd1c8
2013-11-29 11:35:39 -08:00
Edwin Kempin
a7e04e4eea Merge "Fix unclosed resource warnings" 2013-11-29 19:35:12 +00:00
Sasa Zivkov
91205ae876 Fix Daemon start when sshd.listenAddress=off and host key doesn't exist
When a site is initialized with sshd.listenAddress=off, a ssh host key
is not generated. The Daemon startup failed in that case because it
tried to start the SshDaemon and the injection of a KeyPairProvider
failed because the ssh host key didn't exist.

Set the Daemon.sshd option to false also when sshd.listenAddress=off
to ensure the same startup logic as when --disable-sshd option is used.

Change-Id: Ia9a64f77ca4dc977aafa061a9b9a736db947d5df
2013-11-29 17:21:43 +01:00
Sasa Zivkov
33dab6bfce Remove unreachable code in Daemon.createSshInjector
createSshInjector is only invoked when this.sshd is true. Therefore,
the else branch is never used.

The usage of the NoSshModule is handled in the createWebInjector method.

Change-Id: Icc8e20d882387966f35cc5062483229f135bdc57
2013-11-29 16:30:01 +01:00
David Ostrovsky
937d527ac0 Bump bouncycastle verison to 1.49
Many bugs were fixed since version 1.44 that we are using[1].

JARs artifacts were renamed.

[1] http://www.bouncycastle.org/releasenotes.html

Change-Id: Ie2b22328c77b0100dfff61139b737894b88e7664
2013-11-29 08:49:06 +01:00
Shawn Pearce
72fb6cc514 Remove unused .gitignore
These were necessary only for the Maven based build.

Change-Id: Ie26669e6ccae60a52d2db1b8ad362e2fa88a26f2
2013-11-28 22:56:51 -08:00
David Ostrovsky
c53fd3ae49 Delete eclipse left-over files from the Maven poop era
Change-Id: Ie3a75e8c6a2d274cd39e362259ab20cff474eb8d
2013-11-28 22:55:09 -08:00
Shawn Pearce
0b17d5f178 Fix unclosed resource warnings
Eclipse Kepler thinks these resources are unclosed.

The refactoring in JettyDaemon combines three duplicate invocations
and confuses Kepler's JDT enough that the unclosed resource warning
goes away.

Change-Id: I0f376ac6116082ed645d6712fe5d98add66f493e
2013-11-28 22:34:32 -08:00
David Ostrovsky
717715970b Jetty: Fix connector behind SSL reverse proxy
Change-Id: I0c19c78e8e299ec920f70b42ad0a86f5b35e87ed
2013-11-28 21:57:45 +01:00
Eryk Szymanski
5b1168f437 Adjusted LogFileCompressor so it does not rely on log file names
It uses suffixes "_log", ".log", ".run", ".pid" instead.

This way files do not get compressed when using log4j.configuration and
different names.

Change-Id: Ifbe66fb0f9165166b09a37bb5fe4b10e115a3007
Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
2013-11-26 14:48:42 +00:00
Shawn Pearce
dd218662c0 Replace <code> with {@code} in javadoc
{@code foo} is shorter and easier to read and write than
<code>foo</code>, which is why it was introduced years ago in the
javadoc processor.  Make consistent use of it throughout the
documentation comments.

Change-Id: I59d428cb6c5015453629398b0697891b83c8e91d
2013-11-24 13:12:20 -08:00
Edwin Kempin
f8be8fdca6 Keep mergeability flag always up to date
The mergeability flag of a change is immediately updated when the
change is created or when a new patch set is uploaded.

When a branch is updated the mergeability flag is asynchronously
updated for all open changes that are destined for that branch.

This way the mergeability flag is always up to date.  With this the
(new) change screen doesn't need to explicitly trigger the update of
this flag whenever the screen is loaded.  The corresponding call is
removed.

In a follow-up change we can now display the mergeability flag also in
the change tables and user dashboards which wouldn't make sense if the
displayed information is outdated.

It is important to update the mergeability flag on a branch update in
the background since the computation and even the check whether the
mergeability flag needs to be recomputed is expensive.

Change-Id: Id20e567e5c5d5b3d851ca5cda9bde01ac01c9967
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2013-11-23 23:28:50 -08:00
David Ostrovsky
8e4a99051d Document programmatic HTTPD and SSHD logging configuration
Change-Id: Ie342a593a8ae854fe33f312cac22e1089119614a
2013-11-20 00:02:12 +01:00
Eryk Szymanski
66252ed8ea Enable sshd_log and httpd_log to use log4j config
At the moment log4j configuration is a bit inconsistent: it is
possible to configure error_log and gc_log using file provided
with log4j.configuration system property, however httpd_log and
sshd_log configuration is hard-coded in corresponding classes
(HttpLog and SshLog).

Make logs configuration more consistent by using log4j for all
logs. If log4j.configuration variable is not set, log behavior
remains intact and code-level log configuration will be used.

In case of log4.configuration points to log4j.properties file the
hard-coded configuration will be ommited and log4j.properties will
be used instead.

In addition shouldConfigureLogSystem() call moved from ErrorLogFile
to LogUtil in com.google.gerrit.util package and removed deprecated
reference to log4j LogManager.DEFAULT_CONFIGURATION_KEY so that
gerrit common does not require log4j.

Two inner MyLayout classes (one from SshLog and one from HttpLog)
have been extracted to separate files and renamed accordingly to
enable to use them from log4j.properties file if required. At the
moment those are extracted as is - refactoring will follow.

Change-Id: Icb1a3787b98392a9df9bb2afa4dc857f8cfada3a
Signed-off-by: Eryk Szymanski <eryksz@gmail.com>
2013-11-19 13:06:05 -08:00
alex.ryazantsev
84001777ed Simplify conditions with && and ||
Change-Id: I77fb945cdf6b18baec064d1ac4b6002ef02e437a
2013-11-18 00:50:00 +04:00
Shawn Pearce
445a70549e Merge "Bump args4j version to 2.0.26" 2013-11-15 08:05:28 +00:00
David Ostrovsky
985752f232 Bump args4j version to 2.0.26
New version has features which be useful for Gerrit core and plugins:

* new hidden attribute, specifying to hide it in help message
* new depends attribute, specifying the dependent option(s)
* multiValued attribute was removed

Change-Id: Ic7e9f37231cb83940db50fe3b9efe8ad972108cf
2013-11-15 09:58:39 +01:00
David Ostrovsky
8e78797190 Bump Jetty version to 9.0.6.v20130930
Change-Id: Id7306c3a2b9b3f59d24de1b93c114d7a284a3515
2013-11-15 09:24:17 +01:00
alex.ryazantsev
9d3492c0c8 Remove unnecessary invocation toString() method
Change-Id: Ibbf86c9b5a31e65d0f46b869976687727e925624
2013-11-14 02:56:47 +04:00
Dave Borowitz
ec6fca88a5 Make LifecycleModule inherit from FactoryModule
Cut down on a bunch of one-offs of install(new *Module() {...}) by
choosing a more appropriate base module class. This doesn't solve all
such cases, for example RpcServletModule must still inherit from
ServletModule, but it does clean up some code. (And who knows, fewer
modules may even mean faster startup time.)

Change-Id: Ie1aed05d0a64f7f11b121c9a637bb30d80e9a595
2013-11-13 16:14:00 +00:00
alex.ryazantsev
d215908bae Completed test migration to junit4, easymock updated to version 3.2
Change-Id: I6381045b3dae7133cc3589c5dd20ed977118a83d
2013-11-07 11:22:24 -08:00
Shawn Pearce
ab7fc0a1a5 Merge "Add daemon instance to Jython shell session" 2013-11-06 20:48:19 +00:00
David Ostrovsky
947a80fde1 Add daemon instance to Jython shell session
Given that the Daemon instance contains all Guices injectors, all Guice
bindings can be reached from the Daemon instance.  Expose Daemon instance
to the Jython shell session as "d" variable.

For example to dump the global capabilities:

  >>> from com.google.gerrit.server.config import AllProjectsNameProvider
  >>> from com.google.gerrit.server.git.MetaDataUpdate import Server
  >>> from com.google.gerrit.server.git import ProjectConfig
  >>> i = d.sysInjector
  >>> allProjectsNameProvider = i.getInstance(AllProjectsNameProvider)
  >>> metaUpdateFactory = i.getInstance(Server)
  >>> md = metaUpdateFactory.create(allProjectsNameProvider.get())
  >>> cfg = ProjectConfig.read(md)
  >>> s = cfg.getAccessSection("GLOBAL_CAPABILITIES", True)
  >>> for p in s.getPermissions():
  >>> ...   print p
  ...
  accessDatabase [group Administrators]
  administrateServer [group Administrators]
  [...]
  streamEvents [group Non-Interactive Users]
  >>>

Change-Id: If5de7491e55002fff6078741deb43d1dc3ed855e
2013-11-06 22:41:41 +01:00