Skip to content

Commit

Permalink
Merge dspace-services into DSpace
Browse files Browse the repository at this point in the history
  • Loading branch information
mwoodiupui committed Sep 18, 2012
2 parents 3b356ef + 83e8e9d commit 0db0fea
Show file tree
Hide file tree
Showing 127 changed files with 14,173 additions and 0 deletions.
92 changes: 92 additions & 0 deletions dspace-services/api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<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>
<groupId>org.dspace</groupId>
<artifactId>dspace-services-api</artifactId>
<name>DSpace Services API</name>
<description>The core services API for DSpace</description>
<url>http://projects.dspace.org</url>
<inceptionYear>Monday, September 1, 2008</inceptionYear>
<organization>
<name>The DSpace Foundation</name>
<url>http://www.dspace.org</url>
</organization>
<packaging>jar</packaging>

<parent>
<artifactId>dspace-services</artifactId>
<groupId>org.dspace</groupId>
<version>2.0.5-SNAPSHOT</version>
</parent>

<!--
The Subversion repository location is used by Continuum to
update against when changes have occured, this spawns a new
build cycle and releases snapshots into the snapshot repository
below.
-->
<scm>
<connection>scm:svn:http://scm.dspace.org/svn/repo/modules/dspace-services/trunk/api</connection>
<developerConnection>scm:svn:https://scm.dspace.org/svn/repo/modules/dspace-services/trunk/api
</developerConnection>
<url>http://scm.dspace.org/svn/repo/modules/dspace-services/trunk/api</url>
</scm>

<dependencies>
<!-- should be an absolutely minimal set of dependencies -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.4</version>
<scope>provided</scope>
<type>jar</type>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.4</version>
</dependency>
</dependencies>

<build>
<resources>
<!-- include the readme.txt file and the java source files -->
<resource>
<directory>${basedir}/src/main/java</directory>
<includes>
<include>**/*.java</include>
<include>**/*.html</include>
<include>**/*.xml</include>
<include>**/*.properties</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.constants;


/**
* All core DSpace Services constants.
*
* @author Aaron Zeckoski (azeckoski @ gmail.com)
*/
public class Constants {

/**
* If this is set to true then DSpace kernel is run as if it is
* inside a unit test. This means that nothing is persisted (things
* are run in-memory only) and caches and other speed optimizing
* parts are reduced. This should NEVER be set true in a production
* system.
*/
public static final String DSPACE_TESTING_MODE = "dspace.testing";

/**
* This is the name of the timer thread for all DSpace core timers.
*/
public static final String DSPACE_TIMER_NAME = "DSpaceTimer";

/**
* Configuration key for the name of the DBMS being used.
* HSQLDB, DERBY, ORACLE, MYSQL, POSTGRES, DB2, MSSQL.
* Note that H2 uses the HSQLDB key.
*/
public static final String DATABASE_TYPE_KEY = "jdbc.database.type";

/**
* Class of the JDBC driver.
* Embedded drivers are:
* <ul>
* <li>org.h2.Driver</li>
* <li>org.apache.derby.jdbc.EmbeddedDriver</li>
* <li>org.hsqldb.jdbcDriver</li>
* </ul>
* Put your driver in the lib directory for your servlet container.
*/
public static final String DATABASE_DRIVER_KEY = "jdbc.driver.class";

/**
* JDBC database connection URL.
*/
public static final String DATABASE_CONNECTION_KEY = "jdbc.connection.url";

/**
* Database connection user.
*/
public static final String DATABASE_USERNAME_KEY = "jdbc.username";

/**
* Database connection password.
*/
public static final String DATABASE_PASSWORD_KEY = "jdbc.password";

/**
* Set this to true (the default) to enable connection pooling.
*/
public static final String DATABASE_CONN_POOLING = "jdbc.dataSource.pooling";

/**
*
*/
public static final String DEFAULT_ENCODING = "UTF-8";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
/**
* Manifest constants naming configuration data for core services.
*/

package org.dspace.constants;
80 changes: 80 additions & 0 deletions dspace-services/api/src/main/java/org/dspace/kernel/Activator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.kernel;


/**
* An activator is a special type which allows a provider to be plugged into the system by dropping a jar file
* in with the kernel and adding in a hook in the configuration file. Activators are started after the
* initial classes and the service manager have already been started. All classes which implement this
* must have a public empty constructor (takes no parameters) (e.g.
* {@code public MyClass() {}} )
* <p>
* If you want the system to execute your class then you must list it in
* the DSpace configuration with the fully qualified classpath
* (NOTE that the xxx can be anything as long as it is unique): <br/>
* {@code activator.xxx = org.dspace.MyClass}
* </p>
* <p>
* {@link #start(ServiceManager)} will be called after the class is created during kernel startup.
* Developers should create their providers/plugins/etc. in this method and
* use the registration methods in the {@link ServiceManager} to register them.
* {@link #stop(ServiceManager)} will be called when the kernel shuts down. Perform any cleanup/shutdown actions
* you like during this phase (unregistering your services here is a good idea). <br/>
* </p>
* <p>This is modeled after the OSGi {@code BundleActivator}.</p>
* <p>
* There is another type of activator used in DSpace but it is
* configured via the configuration service only. The class activator
* is configured by creating a config property like this
* (NOTE that the xxx can be anything as long as it is unique): <br/>
* {@code activator.class.xxx = org.dspace.MyClass;org.dspace.MyServiceName;constructor}<br/>
* Unlike the normal activators, these are started up when the kernel
* core services start and thus can actually be accessed from the
* service manager and referenced in providers and plugins.
* </p>
*
* @author Aaron Zeckoski (azeckoski @ gmail.com)
*/
public interface Activator {

/**
* This is called when the service manager is starting this activator.
* It is only called once.
* It will be called after the core services are started. The ClassLoader used will be the one
* that this class is associated with to ensure all dependencies are available.
* <p>
* This method should be used to startup and register services in most cases but it can be used
* to simply perform some system startup actions if desired.
* <p>
* Exceptions thrown out of this method will not cause the system startup to fail.
*
* @param serviceManager the current system service manager
*/
public void start(ServiceManager serviceManager);

/**
* This is called when the service manager is shutting down this
* activator. It is only called once.
* It will be called before the core services are stopped. The ClassLoader used will be the one
* that this class is associated with to ensure all dependencies are available.
* <p>
* This method should be used to shutdown and unregister services in most cases but it can be used
* to simply perform some system shutdown actions if desired.
* <p>
* Exceptions thrown out of this method will not cause the system shutdown to fail.
* <p>
* WARNING: this can hang the shutdown by performing operations that
* take a long long time or are deadlocked. The developer is
* expected to ensure this does not happen.
*
* @param serviceManager the current system service manager
*/
public void stop(ServiceManager serviceManager);

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.kernel;

/**
* Beans that have a lifecycle and can be controlled via their lifecycle implement this interface.
* Based on the Sakai K2 lifecycle interface -AZ
*
* @param <T> the type of object managed by this lifecycle.
*/
public interface CommonLifecycle<T> {

/**
* Starts the bean. This initializes and causes the object to begin functioning.
* Should not happen automatically when the object is created.
*/
public void start();

/**
* Stops the bean. This turns the object off and causes related things to be shutdown.
* Object should be able to be started again.
*/
public void stop();

/**
* Gets a reference to the bean that is being managed inside this lifecycle.
* @return the managed object
*/
public T getManagedBean();

/**
* Destroy the managed bean entirely. It will be stopped first if not stopped and cannot be
* started again afterwards.
*/
public void destroy();

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.kernel;

import org.dspace.services.ConfigurationService;

/**
* This is the most core piece of the system: instantiating one will
* startup the dspace services framework.
*
* @author Aaron Zeckoski (azeckoski @ gmail.com)
*/
public interface DSpaceKernel {

public static final String KERNEL_NAME = "Kernel";
public static final String MBEAN_PREFIX = "org.dspace:name=";
public static final String MBEAN_SUFFIX = ",type=DSpaceKernel";
public static final String MBEAN_NAME = MBEAN_PREFIX+KERNEL_NAME+MBEAN_SUFFIX;

/**
* @return the unique MBean name of this DSpace Kernel
*/
public String getMBeanName();

/**
* @return true if this Kernel is started and running
*/
public boolean isRunning();

/**
* @return the DSpace service manager instance for this Kernel
*/
public ServiceManager getServiceManager();

/**
* @return the DSpace configuration service for this Kernel
*/
public ConfigurationService getConfigurationService();

}
Loading

0 comments on commit 0db0fea

Please sign in to comment.