Contributing Code to DSpace Software
- Contribution Quick Checklist
- Overview of Code Approval Process – How to get your Code into DSpace!
- Code Contribution Standards
Contribution Quick Checklist
This page has a lot of great information on it. But, if you just need the high level overview, here it is. NOTE: the checkboxes below are here for "decorative" purposes, and aren't really intended to be used. If you'd like, and you find it helpful, you may print this page and then check off each step as you proceed with your contribution. Happy coding, and please ask for help if you find you need it! We are a community of developers, and we love to help.
- Create a ticket in the DSpace Issue Tracker (describe your contribution, how to use it, and perhaps some use cases).
- Submit your code (preferably via GitHub). It is HIGHLY recommended to do so via a GitHub Pull Request (see Development with Git), which references your newly created ticket by number (e.g. DS-1234). If you are uncomfortable with Git/GitHub, you may instead attach a patch to the ticket you created. Be warned that the review/approval process for patch files is often much slower, as we first must locate someone to create a Pull Request on your behalf.
- Review your own code. Does it follow our Contribution Checklist? Does it need Documentation? If you are using any third party tools/APIs, do they all have an acceptable Open Source License (see Licensing of Contributions)? The Committers will also be reviewing these aspects of your code, but if you can catch these gaps or issues up front it can speed up the process of correcting them.
- Respond to feedback. If the Committers ask questions or make suggestions for changes, please try to be responsive. The Committers are all volunteers and are trying to help as best we can, but the process moves more quickly if you can try to be responsive as well.
- Help rework/update code as needed. If suggestions for changes are made, if you can rework the code, it speeds up the process. If you submitted your code as a Pull Request, you can just quickly add changes/updates to the branch linked to from your Pull Request.
- Ask questions. If there is a long delay in the Committers responding, or if you aren't sure of the status of your contribution, please ask. We'd be glad to explain whether the delay is just because we are all busy, or if there's something else we are waiting on.
- Pay attention to release deadlines. As the next DSpace release approaches, the Committers will announce a "Contribution Deadline" for the upcoming release (usually the release schedule & deadlines are emailed to all lists in July/August). In order to keep releases on-time, the Committers must set a date after which they can no longer accept new feature contributions. Although you may add code contributions year round, they will only be considered for a specific release if they are contributed before that release's contribution deadline.
Overview of Code Approval Process – How to get your Code into DSpace!
0. Share Early, Share Often!
The overriding mantra is share early, share often. Here are a few things to consider before you begin working on your code:
- Please be sure to share your plans with the DSpace community on the 'dspace-devel' list (or via one of the weekly Developer Meetings) before embarking on any sizable development effort. This will ensure you achieve your goals in a way that is consistent with the DSpace architecture and plans of the rest of the community. It will minimize the chances of a scenario where you have invested a large amount of time and effort into a body of code that does not fit in with the DSpace architecture or the consensus of the community.
- Develop incrementally; try and implement and contribute a basic form of your feature as soon as possible, rather than aiming to implement a complete and 'polished' solution. This will help ensure you're on the right track with regards to the rest of the DSpace community and platform. The sooner your code is part of the core code base, the less time you will have to spend 'chasing' the main code base, i.e. keeping your changes up-to-date with that core code base.
- Obtain the DSpace code using GitHub (see also Development with Git). This will make code management much easier. It's very simple to do; see Developer Guidelines and Tools.
- Read Code Contribution Guidelines (this page) to ensure you are following DSpace conventions. This will ensure your code is more likely to be immediately accepted as part of out-of-the-box DSpace.
- Ensure that any third-party tools/libraries that you plan to utilize are released under compatible open source licenses. See the Licensing of Contributions section below.
- For Larger Initiatives/Codebases: If you are building out a much larger project, we highly recommend notifying the community of the work early on via an email to firstname.lastname@example.org. This can help find collaborators or get early feedback. We also recommend you develop your project in GitHub, as it provides easier ways to review/collaborate with other developers.
1. Make your code available (preferrably in GitHub) and create a ticket in our Issue Tracker
Once your code is ready, you must make your code available to the DSpace Committers Group for review. The easiest way for us to review your code is by putting your code into GitHub (just create your own account – it's free!). Then, submit a "Pull Request" to our GitHub repository (see Development with Git). Alternatively, if you are not yet comfortable with GitHub, you may create a patch (and upload it to our DSpace Issue Tracker). However, please be aware that submitting a patch may delay the review process (see below note)
In either case, you must also create a new ticket in our DSpace Issue Tracker. This ensures that the DSpace Developers are notified of your contribution, and acts as a place for us to comment on the work or make suggestions for improvements.
2. Code Review Process
Once the code is made available, the Committers Group will take time to review the work and provide feedback/comments. Usually, one (or more) committers who are interested in this work will contact you and discuss any feedback we have, and whether or not there would need to be some general changes before we could accept it. Some patches/features are readily accepted (because they are stable and look good), others may require more work (if there are concerns or issues that Committers notice).
3. Reworking Code (if necessary) & Next Steps
After the code review & feedback, interested Committers may help you to rework the code (if needed). They'll also provide you with next steps on getting the code into DSpace. If it can be accepted immediately, it will be. If not, we'll try to help figure out the best route forward.
Once your code is accepted, it will be released in the next version of DSpace software! It is time to celebrate, as your name will be added to the prestigious list of DSpace Contributors!
Code Contribution Standards
Code contributions that meet the following standards are much more likely to be accepted. If you don't understand any of these standards, please contact us – we'll be glad to explain or help.
When you contribute to DSpace, please be sure that your submission adheres to the points in this checklist. The DSpace Committers need you to do this to keep quality of the DSpace code high and their work manageable.
- Any changes must be Java 1.6 compliant.
- When possible, your contribution should be a "Pull Request" sent to our GitHub repository (see Development with Git). However, you may also create a patch against the latest version of the code (but submitting a patch may delay the review process, as we will need to locate a volunteer to create a Pull Request on your behalf).
- Ensure the code is commented and correctly formatted (you can use many IDE's format functions to do that or a tool like Jacobe ). Refer to the Coding Conventions section below.
- Your contribution must adhere to licensing requirements to be included. Refer to the Licensing of Contributions below
- User interface patches must be internationalised (see the Internationalization Support (I18nSupport) guide)
- User interface patches must be XHTML-compliant and have a W3C WAI Conformance Level of "Double-A"
- Where possible, new User Interface features are encouraged to support both XMLUI and JSPUI interfaces. However, this is not a requirement. Patches supporting only one interface may be accepted.
- Your patch must come with Documentation. Minimally, technical documentation must be part of the system docs – see Documentation Contributions below. Ideally, we'd also like User/Usage Documentation.
- Examples or Use Cases should be submitted to help Committers understand and adequately test the patch prior to applying it to the core code
- Any new features should be configurable (i.e. try not to make features specific to your own institution, they need to be generalized if possible). Be careful in particular with the
dspace.cfgfile. Make sure you only patch this if you change involved new configuration parameters in it, and make sure you have good default values for them. Don't accidentally include your own local configuration parameters (e.g. host name etc) in the patch! If the new feature is in any way specific to a particular application (e.g. open access, theses), it should be switched off by default
- If you add new configuration parameters, name them appropriately. Also, they should not be required to be in dspace.cfg – if the parameters are omitted, DSpace should continue to operate as before.
- For example, if you add a new e-thesis-related submission step, you might add a couple of new config parameters:
webui.submit.thesisstep = false, the submission process should not be affected for those not using DSpace for e-theses. Also, if your code finds that
webui.submit.thesisstepis missing, it should assume a default of 'false' so that after an update, previous installations of DSpace behave as expected, and they do not have to add that parameter to their
- For example, if you add a new e-thesis-related submission step, you might add a couple of new config parameters:
- Add appropriate WARN, INFO and DEBUG-level logging. Use the included Apache Log4J toolkit, in concert with the
org.dspace.core.LogManagerclass to do this. See
org.dspace.app.webui.servlet.DSpaceServletfor an example of how to do this.
- Retain backwards compatibility where possible. If there are questions/concerns about this, let us know. There are always exceptions.
- No Database schema changes unless absolutely necessary – this will mean upgrading would require effort. In this case, you also need to supply upgrade instructions and/or code to upgrade in existing installation. See Database schema changes below
If there are questions/concerns about any of these guidelines, let us know on the 'dspace-devel' list. We are willing to make exceptions in some areas, if exceptions are necessary.
Your code needs to follow the Sun Java code conventions with the following minor modifications:
- Curly braces must be on new lines.
- Source files must have a copy of the copyright Duraspace notice and BSD license at the top (see Licensing of Contributions below). Also take a look at Copyright and Licensing.
- You must use 4-space tabulation.
- 'else' should be on a new line. 'else if' stays on one line.
- Users of the Eclipse IDE can have eclipse do the formatting automatically using this profile: - Dspace-eclipse-format.xml. See the Eclipse section below for details of how to apply this profile.
Your code should be well commented with Javadoc (including package and class overviews). All code contributions must come with Documentation. At a bare minimum, this should include Technical Documentation covering all configuration options and/or setup. See Documentation Contributions below for more details.
Licensing of Contributions
Any third-party libraries (e.g. JARs / Maven Dependencies) required to compile or run DSpace must be included. The license of any required jar/dependency MUST be compatible with BSD. It must not prevent any commercial use of DSpace, nor have any impact on the rest of the code by its inclusion. It is not acceptable to require additional downloads of JARs/dependencies to make DSpace compile or function.
Non-Java third-party web frameworks or tools (e.g. XSLT, CSS, Images) should follow these same licensing guidelines.
Examples of acceptable licenses:
- Apache License
- Common Development and Distribution License (CDDL)
- Common Public License (CPL)
- GNU Library or "Lesser" General Public License (LGPL)
- MIT / X11 License
- Mozilla Public License
- Additional examples may be found in our LICENSES_THIRD_PARTY file in the source code. This file lists the licenses of all third-party libraries used by DSpace.
Examples of unacceptable licenses:
- GNU General Public License (GPL)
- European Union Public Licence (EUPL)
- Similar to GPL, this license is "share alike" / "strong copyleft" and may require usage of the same license for redistribution or derivatives. For more information, see the EUPL FAQ (specifically the questions "What about compatibility issues?" and "Are there limitations to the use of the software?")
- Any license which strictly forbids "sublicensing" as detailed at http://choosealicense.com/licenses/
- Any license which limits commercial use/redistribution of binary code
JDBC drivers for databases are an exception since:
- They must correspond to the database version and not the DSpace version.
- They are not required for DSpace to compile and run; a variety of databases, including open source databases, may be used.
Database schema changes
Database schema changes will be done only on major revisions to the source; this is when the version number takes the form x.0 (e.g. 2.0). When making patches which cause schema changes, it is necessary to update all of the relevant SQL files with your sequences, tables, views etc. (in /dspace/etc/postgresql, /dspace/etc/oracle, and /dspace/etc/h2):
- database_schema.sql - the SQL to create the database from scratch
- clean-database.sql - the SQL to remove all the parts of the database
- database_schema_<old version>-<new version>.sql (e.g. database_schema_11_12.sql) - the SQL to update the <old version> of the schema to the <new version>
- update-sequences.sql - the SQL to ensure that sequences are set correctly
All new features require documentation before they will be accepted. You may send us code before documentation is completed, but we will be unable to accept that code into DSpace until it is properly documented. Bug fixes may not require documentation, unless they somehow make a modification which changes how DSpace functions.
As of 1.7.0, the documentation is now built in a special section of the Wiki at DSpace Documentation. Therefore, the best way to send us Documentation is to actually create a new page(s) in this DSpace Wiki. You should link these Wiki page(s) to your issue in our DSpace Issue Tracker. We'll move them over into the official DSpace Documentation area once you code has been accepted.