Skip to content

Commit

Permalink
small steps towards a plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
stdotjohn committed Sep 15, 2010
1 parent 499cf79 commit 71982c3
Show file tree
Hide file tree
Showing 8 changed files with 446 additions and 2 deletions.
8 changes: 7 additions & 1 deletion META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ Import-Package: javax.swing,
javax.swing.text.rtf,
javax.swing.tree,
org.apache.log4j,
org.semanticweb.owlapi.apibinding;version="3.1.0",
org.protege.owl.diff.analyzer,
org.protege.owl.diff.analyzer.algorithms,
org.protege.owl.diff.analyzer.util,
org.protege.owl.diff.raw,
org.protege.owl.diff.raw.algorithms,
org.protege.owl.diff.raw.util
org.semanticweb.owlapi.apibinding,
org.semanticweb.owlapi.model
238 changes: 238 additions & 0 deletions build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
<?xml version = "1.0" encoding = "utf-8"?>

<project name = "Protege OWL Diff Plugin" default = "install" basedir = ".">

<!--
To run this build file set the environment variable
PROTEGE_HOME to point to a protege distribution and type ant
install or jar.
-->

<property environment="env"/>
<property name = "protege.home" location="${env.PROTEGE_HOME}"/>
<property file="${protege.home}/build.properties"/>
<property file="local.properties"/>

<property file="version.properties"/>
<property name="major.version" value="1"/>
<property name="minor.version" value="0"/>
<property name="micro.version" value="0"/>

<property name = "plugin" value = "org.protege.editor.owl.diff"/>


<!--
these properties probably don't need changing
-->
<property name = "src" location = "./src"/>
<property name = "build" location = "./build"/>
<property name = "classes" location = "${build}/classes"/>
<property name = "lib" location = "./lib"/>
<property name = "genlib" location = "${build}/lib"/>
<property name = "manifest" location = "${build}/manifest.mf"/>

<property name = "protege.common" location="${protege.home}/bundles"/>
<property name = "protege.plugins" location="${protege.home}/plugins"/>

<property name="equinox.common"
location="${protege.common}/org.eclipse.equinox.common.jar"/>
<property name="equinox.registry"
location="${protege.common}/org.eclipse.equinox.registry.jar"/>
<property name="protege.lib"
location="${protege.common}/org.protege.editor.core.application.jar"/>
<property name="common.lib"
location="${protege.common}/org.protege.common.jar"/>

<property name="owl.lib"
location="${protege.plugins}/org.semanticweb.owl.owlapi.jar"/>

<property name="owl.editor.jar"
location="${protege.plugins}/org.protege.editor.owl.jar"/>

<property name="owl.diff.lib"
location="${protege.plugins}/org.protege.owl.diff.jar"/>

<target name = "init">
<tstamp>
<format property="build.time" pattern="yyyy_MM_dd_hhmm"/>
</tstamp>
<property name="bundle.version"
value="${major.version}.${minor.version}.${micro.version}.${build.time}"/>
<mkdir dir = "${build}"/>
<mkdir dir = "${classes}"/>
<mkdir dir = "${classes}/lib"/>
<mkdir dir = "${genlib}"/>
</target>

<!-- ============================================================= -->
<!-- Configuring the Compile Classpath -->
<!-- ============================================================= -->


<target name="checkProtegeLibsAndReport" depends="checkProtegeLibs"
unless="libs.found">
<echo message="Missing protege libraries. You need to set "/>
<echo message="the PROTEGE_HOME environment variable to a"/>
<echo message="protege installation directory where the"/>
<echo message="appropriate plugins have been installed."/>
<echo message="Alternatively set the jar libs in local.properties (protege.lib=...)"/>
<echo message="Use the -v option to ant to see what jars are missing."/>
<fail message = "missing protege libraries"/>
</target>

<target name = "checkProtegeLibs" depends="init">
<echo message="**********************************************************"/>
<echo message="Using Protege Home = ${protege.home}"/>
<echo message="Using Java Version = ${ant.java.version}" />
<echo message="**********************************************************"/>
<condition property="libs.found">
<and>
<available file="${protege.osgi}" type="file"/>
<available file="${equinox.common}" type = "file"/>
<available file="${equinox.registry}" type = "file"/>
<available file="${owl.editor.jar}" type = "file"/>
<available file="${owl.lib}" type="file"/>
<available file="${owl.diff.lib}" type="file"/>
</and>
</condition>
<path id = "project.classpath">
<pathelement location="${protege.osgi}"/>
<pathelement location="${protege.lib}"/>
<pathelement location="${equinox.common}"/>
<pathelement location="${equinox.registry}"/>
<pathelement location="${owl.editor.jar}"/>
<pathelement location="${owl.lib}"/>
<pathelement location="${owl.diff.lib}"/>
<fileset dir="${genlib}"/>
</path>
</target>

<target name = "buildlibs" depends="checkProtegeLibsAndReport">
<unjar dest="${build}"
src="${common.lib}">
<patternset>
<include name = "**/log4j.jar"/>
<include name = "**/looks.jar"/>
</patternset>
</unjar>
</target>


<target name="build.manifest">
<copy tofile="${manifest}"
file="META-INF/MANIFEST.MF" overwrite="true"/>
<manifest file="${manifest}"
mode = "update">
<attribute name="Built-By" value = "${user.name}"/>
<attribute name="Bundle-Version" value="${bundle.version}"/>
</manifest>
</target>

<target name="copy.resources" depends="build.manifest">
<copy todir="${classes}">
<fileset dir="${src}">
<include name="**/*"/>
<exclude name="**/*.java"/>
<exclude name="**/MANIFEST.MF"/>
<exclude name="**/manifest.mf"/>
</fileset>
</copy>
<copy todir="${classes}">
<fileset dir="." includes="*.xml">
<exclude name="build.xml"/>
</fileset>
</copy>
<!-- the manifest doesn't belong here but this is good for IDE's -->
<mkdir dir="${classes}/META-INF"/>
<copy todir="${classes}/META-INF"
file = "${manifest}"/>
</target>

<target name = "create.update.properties" depends="init">
<property name="update.properties.file"
location="${build}/update.properties"/>
<echo file="${update.properties.file}" append="false">
id=${plugin}
version=${bundle.version}
download=http://smi-protege.stanford.edu/protege4/plugins/4.1/${plugin}.jar
name=Protege OWL Diff Plugin
readme=http://smi-protege.stanford.edu/protege4/plugins/4.1/owldiff-plugin-readme.html
license=http://www.gnu.org/licenses/lgpl.html
author=The Protege Development Team
</echo>
</target>

<target name = "compile" depends = "buildlibs, checkProtegeLibsAndReport">
<javac srcdir = "${src}"
destdir = "${classes}"
debug="on"
includeAntRuntime="false">
<classpath refid = "project.classpath"/>
</javac>
</target>

<target name = "jar" depends = "compile, copy.resources, create.update.properties">
<jar jarfile = "${build}/${plugin}.jar"
basedir = "${classes}"
manifest = "${build}/manifest.mf"/>
</target>

<target name = "install" depends = "jar">
<!-- flush cache -->
<delete dir = "${protege.home}/configuration/org.eclipse.core.runtime"/>
<delete dir = "${protege.home}/configuration/org.eclipse.osgi"/>
<copy file="${build}/${plugin}.jar"
todir = "${protege.plugins}"
overwrite = "true"/>
</target>

<!-- =================================================================== -->
<!-- RUN -->
<!-- =================================================================== -->
<target name = "run" depends="init">
<java fork = "true" dir = "${protege.home}"
classname = "org.protege.osgi.framework.Launcher">
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-Xmx1500M"/>
<classpath>
<pathelement path="${protege.osgi}"/>
<pathelement path="${protege.launcher}"/>
</classpath>
</java>
</target>

<!-- =================================================================== -->
<!-- DEBUG -->
<!-- =================================================================== -->
<target name = "debug" depends="init">
<java fork = "true" dir = "${protege.home}"
classname = "org.protege.osgi.framework.Launcher">
<jvmarg value = "-Dlog4j.configuration=file:log4j.xml"/>
<jvmarg value = "-agentlib:jdwp=transport=dt_socket,address=8500,server=y,suspend=y"/>
<jvmarg value = "-Xmx1500M"/>
<classpath>
<pathelement path="${protege.osgi}"/>
<pathelement path="${protege.launcher}"/>
</classpath>
</java>
</target>


<target name = "clean">
<delete dir = "${build}"/>
</target>


<target name = "usage">
<echo message = "To run this script set the PROTEGE_HOME environment"/>
<echo message = "variable and use one of the following targets"/>
<echo message = "jar - builds the jar (bundle) file for this project"/>
<echo message = "install - installs the bundle into the Protege distribution"/>
<echo message = "copy.resources - copyies resources into the classes directory"/>
<echo message = " this can be useful for ide developers - see the wiki"/>
<echo message = "run - runs Protege (requires that Protege has been installed)"/>
<echo message = "debug - starts Protege with the debugger using port 8500"/>
</target>


</project>
3 changes: 2 additions & 1 deletion plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

<plugin>
<extension-point id="refactor_algorithm" name="Refactor Algorithm" schema="schema/refactor_algorithm.exsd"/>
<extension-point id="analysis_algorithm" name="analysis_algorithm" schema="schema/analysis_algorithm.exsd"/>

<extension id="ChooseOntologyToCompare"
point="org.protege.editor.core.application.ViewComponent">
Expand All @@ -17,7 +18,7 @@
<extension id="ListDifferencesView"
point="org.protege.editor.core.application.ViewComponent">
<label value="Select Ontology for Comparison"/>
<class value="org.protege.editor.owl.diff.ChooseOntologyView"/>
<class value="org.protege.editor.owl.diff.DifferenceList"/>
<headerColor value="@org.protege.classcolor"/>
<category value="@org.protege.classcategory"/>
<navigates value="@org.protege.classcategory"/>
Expand Down
102 changes: 102 additions & 0 deletions schema/analysis_algorithm.exsd
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.protege.editor.owl.diff" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.protege.editor.owl.diff" id="analysis_algorithm" name="analysis_algorithm"/>
</appInfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>

<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="class"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>

</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>

</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>

</documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>

<element name="class">
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
<documentation>

</documentation>
<appInfo>
<meta.attribute kind="java" basedOn=":org.protege.owl.diff.analyzer.AnalyzerAlgorithm"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>

<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="apiinfo"/>
</appInfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>

<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>


</schema>
1 change: 1 addition & 0 deletions schema/refactor_algorithm.exsd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
</annotation>
<complexType>
<sequence>
<element ref="class"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
Expand Down
Loading

0 comments on commit 71982c3

Please sign in to comment.