Skip to content
This repository has been archived by the owner on Jul 3, 2018. It is now read-only.

Commit

Permalink
#2 add dummy publisher
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-conway committed May 26, 2016
1 parent 28ff6bb commit c7de816
Show file tree
Hide file tree
Showing 6 changed files with 121 additions and 7 deletions.
26 changes: 26 additions & 0 deletions dummy-publish/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>org.iplantc.de</groupId>
<artifactId>publisher</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.iplantc.de</groupId>
<artifactId>dummy-publish</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>publisher api dummy implementation with a noop</name>
<dependencies>
<dependency>
<groupId>org.irods.jargon</groupId>
<artifactId>jargon-core</artifactId>
</dependency>
<dependency>
<groupId>org.iplantc.de</groupId>
<artifactId>publisher-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,6 @@
<modules>
<module>publisher-api</module>
<module>publisher-sandbox</module>
<module>dummy-publish</module>
</modules>
</project>
9 changes: 2 additions & 7 deletions publisher-sandbox/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,12 @@
<artifactId>publisher-sandbox</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>publisher sandbox</name>
<name>publisher framework for DE - API</name>
<dependencies>
<dependency>
<groupId>org.iplantc.de</groupId>
<artifactId>publisher-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.10</version>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*/
package org.iplantc.de.publish.sandbox;

import java.io.File;
import java.net.URL;
import java.util.ArrayList;

import org.iplantc.de.publish.mechanism.api.exception.PublicationException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -56,6 +60,31 @@ public void init() throws PublicationException {
"init() cannot be called, no provided sandboxConfiguration");
}

if (sandboxConfiguration.getJarFilePluginDir() == null
|| sandboxConfiguration.getJarFilePluginDir().isEmpty()) {
throw new PublicationException(
"no jar file plugin directory specified");
}

log.info("scanning for plugin jars at:{}",
sandboxConfiguration.getJarFilePluginDir());

}

public void initialize(String libDir) throws Exception {
File dependencyDirectory = new File(libDir);
File[] files = dependencyDirectory.listFiles();
ArrayList<URL> urls = new ArrayList<URL>();
for (int i = 0; i < files.length; i++) {
if (files[i].getName().endsWith(".jar")) {
urls.add(files[i].toURL());
// urls.add(files[i].toURI().toURL());
}
} /*
* classLoader = new JarFileClassLoader("Scheduler CL" +
* System.currentTimeMillis(), urls.toArray(new URL[urls.size()]),
* GFClassLoader.class.getClassLoader());
*/
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/**
*
*/
package org.iplantc.de.publish.sandbox;

/**
* Configurable classloader for sandbox testing of jars
*
* @author Mike Conway - DICE
*
*/
public class SandboxClassloader extends ClassLoader {

/**
*
*/
public SandboxClassloader() {
}

/**
* @param classloader
*/
public SandboxClassloader(ClassLoader classloader) {
super(classloader);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,40 @@
*/
public class SandboxConfiguration {

/**
* Directory to scan for plugin publisher jar files
*/
private String jarFilePluginDir = "";

/**
* @return the jarFilePluginDir
*/
public String getJarFilePluginDir() {
return jarFilePluginDir;
}

/**
* @param jarFilePluginDir
* the jarFilePluginDir to set
*/
public void setJarFilePluginDir(String jarFilePluginDir) {
this.jarFilePluginDir = jarFilePluginDir;
}

/*
* (non-Javadoc)
*
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("SandboxConfiguration [");
if (jarFilePluginDir != null) {
builder.append("jarFilePluginDir=").append(jarFilePluginDir);
}
builder.append("]");
return builder.toString();
}

}

0 comments on commit c7de816

Please sign in to comment.