Search in sources :

Example 11 with Document

use of electric.xml.Document in project blue by kunstmusik.

the class BlueShareRemoteCaller method getInstrumentOptions.

public static InstrumentOption[] getInstrumentOptions(BlueShareInstrumentCategory iCategory) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    Document doc;
    v.add(new Integer(iCategory.getCategoryId()));
    result = (String) xrpc.execute("blueShare.getInstrumentList", v);
    doc = new Document(result);
    Element root = doc.getRoot();
    Elements instruments = root.getElements("instrument");
    InstrumentOption[] iOptions = new InstrumentOption[instruments.size()];
    int i = 0;
    int instrumentId;
    String screenName, name, type, description, category;
    Element temp;
    while (instruments.hasMoreElements()) {
        temp = instruments.next();
        instrumentId = Integer.parseInt(temp.getAttribute("instrumentId").getValue());
        screenName = temp.getElement("screenName").getTextString();
        name = temp.getElement("name").getTextString();
        type = temp.getElement("type").getTextString();
        description = temp.getElement("description").getTextString();
        category = temp.getElement("category").getTextString();
        iOptions[i] = new InstrumentOption(instrumentId, checkNullString(screenName), checkNullString(name), checkNullString(type), checkNullString(description), checkNullString(category));
        i++;
    }
    return iOptions;
}
Also used : InstrumentOption(blue.tools.blueShare.instruments.InstrumentOption) Element(electric.xml.Element) Document(electric.xml.Document) Elements(electric.xml.Elements) Vector(java.util.Vector)

Example 12 with Document

use of electric.xml.Document in project blue by kunstmusik.

the class BlueShareRemoteCaller method getEffect.

public static Effect getEffect(EffectOption iOption) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    v.add(new Integer(iOption.getInstrumentId()));
    result = (String) xrpc.execute("blueShare.getEffect", v);
    Effect effect = null;
    try {
        Document d = new Document(result);
        effect = Effect.loadFromXML(d.getRoot());
    } catch (Exception e) {
    }
    return effect;
}
Also used : Effect(blue.mixer.Effect) Document(electric.xml.Document) Vector(java.util.Vector) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) ParseException(electric.xml.ParseException)

Example 13 with Document

use of electric.xml.Document in project blue by kunstmusik.

the class BlueShareRemoteCaller method getSoundObjectCategoryTree.

/* SOUNDOBJECT METHODS */
public static BlueShareSoundObjectCategory[] getSoundObjectCategoryTree() throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    Document doc;
    result = (String) xrpc.execute("blueShare.getSoundObjectCategoryTree", v);
    doc = new Document(result);
    Element root = doc.getRoot();
    return getSoundObjectSubCategories(root);
}
Also used : Element(electric.xml.Element) Document(electric.xml.Document) Vector(java.util.Vector)

Example 14 with Document

use of electric.xml.Document in project blue by kunstmusik.

the class BlueShareRemoteCaller method getSoundObject.

public static SoundObject getSoundObject(SoundObjectOption iOption) throws IOException, XmlRpcException, ParseException {
    Vector v = new Vector();
    String result;
    v.add(new Integer(iOption.getSoundObjectId()));
    result = (String) xrpc.execute("blueShare.getSoundObject", v);
    SoundObject soundObject = null;
    try {
        Document d = new Document(result);
        soundObject = (SoundObject) ObjectUtilities.loadFromXML(d.getRoot(), new HashMap<>());
    } catch (Exception e) {
    }
    return soundObject;
}
Also used : SoundObject(blue.soundObject.SoundObject) Document(electric.xml.Document) Vector(java.util.Vector) IOException(java.io.IOException) XmlRpcException(org.apache.xmlrpc.XmlRpcException) ParseException(electric.xml.ParseException)

Example 15 with Document

use of electric.xml.Document in project blue by kunstmusik.

the class CodeRepositoryManager method saveCodeRepository.

public static void saveCodeRepository(DefaultMutableTreeNode node) {
    Element root = getElement(node);
    Document doc = new Document();
    doc.addChild(new XMLDecl("1.0", "UTF-8"));
    doc.setRoot(root);
    try {
        try (FileOutputStream out = new FileOutputStream(BlueSystem.getCodeRepository())) {
            doc.write(out);
            out.flush();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    CodeRepositoryMenu.reinitialize();
}
Also used : Element(electric.xml.Element) FileOutputStream(java.io.FileOutputStream) XMLDecl(electric.xml.XMLDecl) Document(electric.xml.Document) ParseException(electric.xml.ParseException)

Aggregations

Document (electric.xml.Document)35 Element (electric.xml.Element)22 ParseException (electric.xml.ParseException)17 Vector (java.util.Vector)17 IOException (java.io.IOException)13 Elements (electric.xml.Elements)12 File (java.io.File)12 XmlRpcException (org.apache.xmlrpc.XmlRpcException)6 SoundObject (blue.soundObject.SoundObject)4 EffectOption (blue.tools.blueShare.effects.EffectOption)3 InstrumentOption (blue.tools.blueShare.instruments.InstrumentOption)3 SoundObjectOption (blue.tools.blueShare.soundObjects.SoundObjectOption)3 MissingResourceException (java.util.MissingResourceException)3 BlueData (blue.BlueData)2 UDOLibrary (blue.udo.UDOLibrary)2 FileOutputStream (java.io.FileOutputStream)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 SoundLayer (blue.SoundLayer)1 Library (blue.library.Library)1 Effect (blue.mixer.Effect)1