Skip to content
Snippets Groups Projects
Commit 22d554c0 authored by Roger W Feese's avatar Roger W Feese
Browse files

First commit of code.

parents
No related branches found
No related tags found
No related merge requests found
build.properties
Copyright (c) 2015 University of Nebraska-Lincoln
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Blackboard Content Management System Tools
Command-line tools for managing large numbers of directories in the content system. These are built against internal Xythos APIs that are shipped with but not documented in Blackboard. The scripts in the "scripts" directory follow the structure of typical command-line scripts shipped with Blackboard and should be run by the "bbuser" user account.
Project Directory Structure
The project is set up to build using Ant. The primary build
configuration is in the "build.xml" file.
/ project root
/lib Java libraries needed for build or run-time
/src Source files for any unique Java classes used in this project
/config Taglibs directory used by Bb building block
/build Dynamically created data generated by Ant build targets.
/scripts Scripts intended to be run from the command-line.
# path to blackboard libs
bb-libs.dir=
<project name="bb_cms_tools" default="compile_java_classes" basedir=".">
<!-- Set some project variables and parameters -->
<!-- build.properties for local config customizations -->
<property file="build.properties" />
<property name="src.dir" value="src" />
<property name="conf.dir" value="conf" />
<property name="build.dir" value="build" />
<property name="classes.dir" value="${build.dir}/classes"/>
<property name="lib.dir" value="lib" />
<path id="classes-build-classpath">
<fileset dir="${lib.dir}">
<include name="*.jar" />
</fileset>
<fileset dir="${bb-libs.dir}">
<include name="*.jar" />
</fileset>
</path>
<!-- Remove all compiled and built components -->
<target name="clean">
<delete dir="${classes.dir}" />
<delete dir="${build.dir}" />
</target>
<target name="build_prep">
<mkdir dir="${build.dir}" />
</target>
<!-- Compile local Java source files into class files. -->
<target name="compile_java_classes" depends="build_prep">
<mkdir dir="${classes.dir}" />
<javac srcdir="${src.dir}" destdir="${classes.dir}" includeantruntime="false">
<classpath refid="classes-build-classpath" />
</javac>
</target>
</project>
Manifest-Version: 1.0
#!/bin/bash
BLACKBOARD_HOME=/usr/local/blackboard
source ${BLACKBOARD_HOME}/system/lib/bb-common.sh
#Java environment variables
JAVA_OPTS="$JAVA_OPTS -Dblackboard.home=$BLACKBOARD_HOME"
JAVA_OPTS="$JAVA_OPTS -Dbbservices_config=$BLACKBOARD_HOME/config/service-config-cs-commandline.properties"
JAVA_OPTS="$JAVA_OPTS -DXythos.RunMode=Application"
JAVA_OPTS="$JAVA_OPTS -Djava.system.class.loader=blackboard.cms.commandline.classloader.BbCommandLineClassLoader"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
#build classpath
CP=build/classes
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-cms-classloader.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-platform.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-exec.jar
CP=${CP}:/usr/local/blackboard/apps/tomcat/lib/servlet-api.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-bbxythos.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xsscore.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xssoracle.jar
#Make sure we are executing as the correct user
relaunch_as_bbuser "$@"
$JAVA_EXEC -classpath $CP $JAVA_OPTS edu.unl.util.CreateDirectory "$@"
#!/bin/bash
BLACKBOARD_HOME=/usr/local/blackboard
source ${BLACKBOARD_HOME}/system/lib/bb-common.sh
#Java environment variables
JAVA_OPTS="$JAVA_OPTS -Dblackboard.home=$BLACKBOARD_HOME"
JAVA_OPTS="$JAVA_OPTS -Dbbservices_config=$BLACKBOARD_HOME/config/service-config-cs-commandline.properties"
JAVA_OPTS="$JAVA_OPTS -DXythos.RunMode=Application"
JAVA_OPTS="$JAVA_OPTS -Djava.system.class.loader=blackboard.cms.commandline.classloader.BbCommandLineClassLoader"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
#build classpath
CP=build/classes
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-cms-classloader.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-platform.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-exec.jar
CP=${CP}:/usr/local/blackboard/apps/tomcat/lib/servlet-api.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-bbxythos.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xsscore.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xssoracle.jar
#Make sure we are executing as the correct user
relaunch_as_bbuser "$@"
$JAVA_EXEC -classpath $CP $JAVA_OPTS edu.unl.util.DeleteEntry "$@"
#!/bin/bash
BLACKBOARD_HOME=/usr/local/blackboard
source ${BLACKBOARD_HOME}/system/lib/bb-common.sh
#Java environment variables
JAVA_OPTS="$JAVA_OPTS -Dblackboard.home=$BLACKBOARD_HOME"
JAVA_OPTS="$JAVA_OPTS -Dbbservices_config=$BLACKBOARD_HOME/config/service-config-cs-commandline.properties"
JAVA_OPTS="$JAVA_OPTS -DXythos.RunMode=Application"
JAVA_OPTS="$JAVA_OPTS -Djava.system.class.loader=blackboard.cms.commandline.classloader.BbCommandLineClassLoader"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
#build classpath
CP=build/classes
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-cms-classloader.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-platform.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-exec.jar
CP=${CP}:/usr/local/blackboard/apps/tomcat/lib/servlet-api.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-bbxythos.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xsscore.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xssoracle.jar
#Make sure we are executing as the correct user
relaunch_as_bbuser "$@"
$JAVA_EXEC -classpath $CP $JAVA_OPTS edu.unl.util.ListDirectory "$@"
#!/bin/bash
BLACKBOARD_HOME=/usr/local/blackboard
source ${BLACKBOARD_HOME}/system/lib/bb-common.sh
#Java environment variables
JAVA_OPTS="$JAVA_OPTS -Dblackboard.home=$BLACKBOARD_HOME"
JAVA_OPTS="$JAVA_OPTS -Dbbservices_config=$BLACKBOARD_HOME/config/service-config-cs-commandline.properties"
JAVA_OPTS="$JAVA_OPTS -DXythos.RunMode=Application"
JAVA_OPTS="$JAVA_OPTS -Djava.system.class.loader=blackboard.cms.commandline.classloader.BbCommandLineClassLoader"
JAVA_OPTS="$JAVA_OPTS -Djava.awt.headless=true"
#build classpath
CP=build/classes
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-cms-classloader.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-platform.jar
CP=${CP}:/usr/local/blackboard/systemlib/bb-exec.jar
CP=${CP}:/usr/local/blackboard/apps/tomcat/lib/servlet-api.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/bb-bbxythos.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xsscore.jar
CP=${CP}:/usr/local/blackboard/systemlib/xythos/xssoracle.jar
#Make sure we are executing as the correct user
relaunch_as_bbuser "$@"
$JAVA_EXEC -classpath $CP $JAVA_OPTS edu.unl.util.RemoveAccessControlEntry "$@"
package edu.unl.util;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
import blackboard.cms.filesystem.*;
import blackboard.cms.apis.*;
import blackboard.platform.BbServiceManager;
import blackboard.platform.context.impl.ContextManagerServerImpl;
import blackboard.platform.context.ContextManager;
import blackboard.platform.vxi.data.VirtualHost;
import blackboard.platform.vxi.service.VirtualInstallationManager;
import com.xythos.common.api.*;
/**
* Create a specified directory in the content system.
*/
public class CreateDirectory {
public static void main(java.lang.String[] args) throws Exception {
String full_path = null;
//parse the argument
if(args.length > 0){
full_path = args[0];
}
if(full_path == null){
System.err.println("Unable to parse directory name. You must supply directory name will full path.");
return;
}
blackboard.platform.context.ContextManager ctxManager = null;
try{
blackboard.platform.vxi.service.VirtualInstallationManager viManager = blackboard.platform.vxi.service.VirtualInstallationManagerFactory.getInstance();
java.util.List<blackboard.platform.vxi.data.VirtualInstallation> vis = viManager.getAllVirtualInstallations();
blackboard.platform.vxi.data.VirtualInstallation vi = vis.get(0);
ctxManager = blackboard.platform.context.ContextManagerFactory.getInstance();
ctxManager.setContext(vi);
DirectoryStructure.createDirectory(full_path);
}
catch(Exception myException){
System.err.println("Error creating directory.");
System.out.println(myException.getMessage());
myException.printStackTrace(System.out);
}
if(ctxManager != null){
ctxManager.releaseContext();
}
System.exit(1);
}
}
package edu.unl.util;
import blackboard.cms.filesystem.*;
import blackboard.cms.apis.*;
import blackboard.platform.BbServiceManager;
import blackboard.platform.context.impl.ContextManagerServerImpl;
import blackboard.platform.context.ContextManager;
import blackboard.platform.vxi.data.VirtualHost;
import blackboard.platform.vxi.service.VirtualInstallationManager;
import com.xythos.common.api.*;
import com.xythos.security.api.*;
import com.xythos.storageServer.api.*;
/**
* Delete the specified entry (file or directory) in the content system.
*/
public class DeleteEntry {
public static void main(java.lang.String[] args) throws Exception {
String full_path = null;
//parse the argument
if(args.length > 0){
full_path = args[0];
}
if(full_path == null){
System.err.println("Unable to parse directory name. You must supply directory name will full path.");
return;
}
blackboard.platform.context.ContextManager ctxManager = null;
com.xythos.security.api.Context securityContext = null;
try{
blackboard.platform.vxi.service.VirtualInstallationManager viManager = blackboard.platform.vxi.service.VirtualInstallationManagerFactory.getInstance();
java.util.List<blackboard.platform.vxi.data.VirtualInstallation> vis = viManager.getAllVirtualInstallations();
blackboard.platform.vxi.data.VirtualInstallation vi = vis.get(0);
ctxManager = blackboard.platform.context.ContextManagerFactory.getInstance();
ctxManager.setContext(vi);
securityContext = blackboard.cms.xythos.XythosContextUtil.getContext();
blackboard.cms.xythos.XythosContextUtil.overrideSecurityManager(securityContext);
com.xythos.common.api.VirtualServer vs = blackboard.cms.xythos.XythosContextUtil.getVirtualServer();
FileSystemEntry fse = FileSystem.findEntry(vs, full_path, false, securityContext);
fse.delete();
}
catch(Exception myException){
System.err.println("Error deleting entry.");
System.out.println(myException.getMessage());
myException.printStackTrace(System.out);
}
if(securityContext != null){
blackboard.cms.xythos.XythosContextUtil.releaseContext(securityContext);
blackboard.cms.xythos.XythosContextUtil.restoreSecurityManager(securityContext);
}
if(ctxManager != null){
ctxManager.releaseContext();
}
System.exit(1);
}
}
package edu.unl.util;
import blackboard.cms.filesystem.*;
import blackboard.cms.apis.*;
import blackboard.platform.BbServiceManager;
import blackboard.platform.context.impl.ContextManagerServerImpl;
import blackboard.platform.context.ContextManager;
import blackboard.platform.vxi.data.VirtualHost;
import blackboard.platform.vxi.service.VirtualInstallationManager;
import com.xythos.common.api.*;
import com.xythos.security.api.*;
import com.xythos.storageServer.api.*;
/**
* List the contents of the specified directory in the content system.
*/
public class ListDirectory {
public static void main(java.lang.String[] args) throws Exception {
String full_path = null;
//parse the argument
if(args.length > 0){
full_path = args[0];
}
if(full_path == null){
System.err.println("Unable to parse directory name. You must supply directory name will full path.");
return;
}
blackboard.platform.context.ContextManager ctxManager = null;
com.xythos.security.api.Context securityContext = null;
try{
blackboard.platform.vxi.service.VirtualInstallationManager viManager = blackboard.platform.vxi.service.VirtualInstallationManagerFactory.getInstance();
java.util.List<blackboard.platform.vxi.data.VirtualInstallation> vis = viManager.getAllVirtualInstallations();
blackboard.platform.vxi.data.VirtualInstallation vi = vis.get(0);
ctxManager = blackboard.platform.context.ContextManagerFactory.getInstance();
ctxManager.setContext(vi);
securityContext = blackboard.cms.xythos.XythosContextUtil.getContext();
blackboard.cms.xythos.XythosContextUtil.overrideSecurityManager(securityContext);
com.xythos.common.api.VirtualServer vs = blackboard.cms.xythos.XythosContextUtil.getVirtualServer();
FileSystemEntry fse = FileSystem.findEntry(vs, full_path, false, securityContext);
if(fse instanceof FileSystemDirectory){
FileSystemDirectory fsd = (FileSystemDirectory)fse;
FileSystemEntry[] entries = fsd.getDirectoryContents(false);
for(FileSystemEntry entry : entries){
System.out.println(entry.getName());
}
}
else{
System.out.println(fse.getName());
}
}
catch(Exception myException){
System.err.println("Error creating directory.");
System.out.println(myException.getMessage());
myException.printStackTrace(System.out);
}
if(securityContext != null){
blackboard.cms.xythos.XythosContextUtil.releaseContext(securityContext);
blackboard.cms.xythos.XythosContextUtil.restoreSecurityManager(securityContext);
}
if(ctxManager != null){
ctxManager.releaseContext();
}
System.exit(1);
}
}
package edu.unl.util;
import java.io.File;
import java.io.FileInputStream;
import java.util.Properties;
import java.util.List;
import java.util.ArrayList;
import blackboard.cms.filesystem.*;
import blackboard.cms.apis.*;
import blackboard.platform.BbServiceManager;
import blackboard.platform.context.impl.ContextManagerServerImpl;
import blackboard.platform.context.ContextManager;
import blackboard.platform.vxi.data.VirtualHost;
import blackboard.platform.vxi.service.VirtualInstallationManager;
import com.xythos.common.api.*;
/**
* Remove the specified access control entry from specified dir/file entry in the content system.
*/
public class RemoveAccessControlEntry {
public static void main(java.lang.String[] args) throws Exception {
String full_path = null;
String acEntry = null;
//parse the argument
if(args.length > 0){
full_path = args[0];
}
if(full_path == null){
System.err.println("Unable to parse directory name. You must supply directory name will full path.");
return;
}
if(args.length > 1){
acEntry = args[1];
}
if(acEntry == null){
System.err.println("Unable to parse access control entry string. You must supply ACE string.");
return;
}
blackboard.platform.context.ContextManager ctxManager = null;
try{
blackboard.platform.vxi.service.VirtualInstallationManager viManager = blackboard.platform.vxi.service.VirtualInstallationManagerFactory.getInstance();
java.util.List<blackboard.platform.vxi.data.VirtualInstallation> vis = viManager.getAllVirtualInstallations();
blackboard.platform.vxi.data.VirtualInstallation vi = vis.get(0);
ctxManager = blackboard.platform.context.ContextManagerFactory.getInstance();
ctxManager.setContext(vi);
List<String> acList = new ArrayList<String>();
acList.add(acEntry);
AccessControl.removeAccessPermissions(full_path, acList);
}
catch(Exception myException){
System.err.println("Error removing access control.");
System.out.println(myException.getMessage());
myException.printStackTrace(System.out);
}
if(ctxManager != null){
ctxManager.releaseContext();
}
System.exit(1);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment