Update to Nilus 3

This commit is contained in:
Douglas Gillespie 2023-02-23 13:37:53 +00:00
parent 9c10af43bc
commit bfed9cfa00
4 changed files with 60 additions and 64 deletions

View File

@ -17,10 +17,6 @@
<attribute name="maven.pomderived" value="true"/> <attribute name="maven.pomderived" value="true"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="lib" path="C:/Users/dg50/Tethys/NilusXMLGenerator/target/nilus-1.5.jar"> <classpathentry kind="lib" path="C:/Users/dg50/source/repos/nilusxmlgenerator/target/nilus-3.0.jar"/>
<attributes>
<attribute name="javadoc_location" value="jar:file:/C:/Users/dg50/Tethys/NilusXMLGenerator/target/nilus-1.5-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -11,8 +11,8 @@ import javax.swing.JMenuItem;
import PamController.PamControlledUnit; import PamController.PamControlledUnit;
import PamController.PamController; import PamController.PamController;
import PamguardMVC.PamDataBlock; import PamguardMVC.PamDataBlock;
import nilus.Deployment; //import nilus.Deployment;
import nilus.Deployment.Instrument; //import nilus.Deployment.Instrument;
import tethys.output.StreamExportParams; import tethys.output.StreamExportParams;
import tethys.output.TethysExportParams; import tethys.output.TethysExportParams;
import tethys.output.TethysExporter; import tethys.output.TethysExporter;

View File

@ -12,10 +12,10 @@ import javax.xml.bind.Marshaller;
import javax.xml.namespace.QName; import javax.xml.namespace.QName;
import javax.xml.validation.Schema; import javax.xml.validation.Schema;
import nilus.Deployment.Data.Audio; //import nilus.Deployment.Data.Audio;
import nilus.Deployment; //import nilus.Deployment;
import nilus.Deployment.Data; //import nilus.Deployment.Data;
import nilus.Deployment.Instrument; //import nilus.Deployment.Instrument;
public class DeploymentWrapper<T extends Serializable> { public class DeploymentWrapper<T extends Serializable> {
@ -34,52 +34,52 @@ public class DeploymentWrapper<T extends Serializable> {
public static void main(String[] args) { public static void main(String[] args) {
// quick play with some JAXB objects to see what they can do. // quick play with some JAXB objects to see what they can do.
Deployment deployment = new Deployment(); // Deployment deployment = new Deployment();
//
Class<? extends Deployment> deploymentClass = deployment.getClass(); // Class<? extends Deployment> deploymentClass = deployment.getClass();
Annotation[] annots = deploymentClass.getAnnotations(); // Annotation[] annots = deploymentClass.getAnnotations();
AnnotatedType[] annotInterfaces = deploymentClass.getAnnotatedInterfaces(); // AnnotatedType[] annotInterfaces = deploymentClass.getAnnotatedInterfaces();
Annotation[] declAnnots = deploymentClass.getDeclaredAnnotations(); // Annotation[] declAnnots = deploymentClass.getDeclaredAnnotations();
//
Instrument instrument = new Instrument(); // Instrument instrument = new Instrument();
instrument.setID("22"); // instrument.setID("22");
instrument.setType("SoundTrap"); // instrument.setType("SoundTrap");
QName qName = new QName("Instrument"); // QName qName = new QName("Instrument");
JAXBElement<Instrument> jInst = new JAXBElement<Deployment.Instrument>(qName, Instrument.class, instrument); // JAXBElement<Instrument> jInst = new JAXBElement<Deployment.Instrument>(qName, Instrument.class, instrument);
deployment.getContent().add(jInst); // deployment.getContent().add(jInst);
//
Deployment.Data data = new Data(); // Deployment.Data data = new Data();
Audio audio = new Audio(); // Audio audio = new Audio();
audio.setProcessed("??"); // audio.setProcessed("??");
data.setAudio(audio); // data.setAudio(audio);
JAXBElement jData = new JAXBElement<Deployment.Data>(new QName("Data"), Data.class, data); // JAXBElement jData = new JAXBElement<Deployment.Data>(new QName("Data"), Data.class, data);
deployment.getContent().add(jData); // deployment.getContent().add(jData);
//
String project = "Project Name"; // String project = "Project Name";
JAXBElement<String> jProj = new JAXBElement<String>(new QName("Project"), String.class, project); // JAXBElement<String> jProj = new JAXBElement<String>(new QName("Project"), String.class, project);
deployment.getContent().add(jProj); // deployment.getContent().add(jProj);
//
String aaa = "Project Something else"; // String aaa = "Project Something else";
JAXBElement<String> jProj2 = new JAXBElement<String>(new QName("Region"), String.class, aaa); // JAXBElement<String> jProj2 = new JAXBElement<String>(new QName("Region"), String.class, aaa);
deployment.getContent().add(jProj2); // deployment.getContent().add(jProj2);
//
//
try { // try {
JAXBContext jContext = JAXBContext.newInstance(Deployment.class); // JAXBContext jContext = JAXBContext.newInstance(Deployment.class);
Marshaller mar = (Marshaller) jContext.createMarshaller(); // Marshaller mar = (Marshaller) jContext.createMarshaller();
mar.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true); // mar.setProperty(javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT, true);
//
ByteArrayOutputStream bos = new ByteArrayOutputStream(); // ByteArrayOutputStream bos = new ByteArrayOutputStream();
mar.marshal(deployment, bos); // mar.marshal(deployment, bos);
String xml = new String(bos.toByteArray()); // String xml = new String(bos.toByteArray());
System.out.println(xml); // System.out.println(xml);
// Schema schema = mar.getSchema(); // is null. Can't generate it's own it seems. //// Schema schema = mar.getSchema(); // is null. Can't generate it's own it seems.
//
} catch (Exception e) { // } catch (Exception e) {
// TODO Auto-generated catch block // // TODO Auto-generated catch block
e.printStackTrace(); // e.printStackTrace();
} // }
//
} }
} }

View File

@ -2,7 +2,7 @@ package tethys.deployment;
import java.io.Serializable; import java.io.Serializable;
import nilus.DeploymentRecoveryDetails; //import nilus.DeploymentRecoveryDetails;
/** /**
* Wrapper and functions associated with the Tethys Deployment object which can * Wrapper and functions associated with the Tethys Deployment object which can
@ -49,12 +49,12 @@ public class PamDeployment {
public PamDeployment() { public PamDeployment() {
} }
//
public DeploymentRecoveryDetails getDeploymentRecoveryDetails() { // public DeploymentRecoveryDetails getDeploymentRecoveryDetails() {
DeploymentRecoveryDetails drd = new DeploymentRecoveryDetails(); // DeploymentRecoveryDetails drd = new DeploymentRecoveryDetails();
//
return null; // return null;
} // }
private void ripApart(Serializable object) { private void ripApart(Serializable object) {
Class cls = object.getClass(); Class cls = object.getClass();