Search in sources :

Example 1 with ParseException

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

the class BlueSystem method getCodeRepository.

public static File getCodeRepository() {
    File repository = new File(blue.BlueSystem.getUserConfigurationDirectory() + File.separator + "codeRepository.xml");
    if (!repository.exists()) {
        System.out.println("Copying default code repository to user configuration directory");
        try {
            Document doc = new Document(BlueSystem.class.getResourceAsStream("codeRepository.xml"));
            doc.write(repository);
        } catch (ParseException | IOException ex) {
            ExceptionHandler.printStackTrace(ex);
        }
    }
    return repository;
}
Also used : ParseException(electric.xml.ParseException) IOException(java.io.IOException) Document(electric.xml.Document) File(java.io.File)

Example 2 with ParseException

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

the class BlueSystem method getUserInstrumentLibrary.

public static InstrumentLibrary getUserInstrumentLibrary() {
    if (userInstrumentLibrary == null) {
        String userInstrFileName = BlueSystem.getUserConfigurationDirectory() + File.separator + "userInstrumentLibrary.xml";
        File f = new File(userInstrFileName);
        if (f.exists()) {
            boolean error = false;
            try {
                Document doc = new Document(f);
                userInstrumentLibrary = InstrumentLibrary.loadFromXML(doc.getRoot());
            } catch (ParseException e1) {
                e1.printStackTrace();
                error = true;
            } catch (Exception e) {
                e.printStackTrace();
                error = true;
            }
            if (error) {
                JOptionPane.showMessageDialog(null, "There was an error loading " + f.getAbsolutePath() + "\nPlease fix this file or remove it and restart blue.", "Error", JOptionPane.ERROR_MESSAGE);
                System.exit(0);
            }
        } else {
            userInstrumentLibrary = new InstrumentLibrary();
        }
    }
    return userInstrumentLibrary;
}
Also used : ParseException(electric.xml.ParseException) Document(electric.xml.Document) File(java.io.File) MissingResourceException(java.util.MissingResourceException) IOException(java.io.IOException) ParseException(electric.xml.ParseException)

Example 3 with ParseException

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

the class BlueShare method selectServer.

private static String selectServer() {
    String retVal = null;
    // get server list from disk
    try {
        Document doc = new Document(new File(BlueSystem.getConfDir() + File.separator + "blueShare.xml"));
        Element root = doc.getRoot();
        Elements servers = root.getElements("server");
        Object[] serverOptions = new Object[servers.size()];
        int i = 0;
        while (servers.hasMoreElements()) {
            serverOptions[i] = servers.next().getTextString();
            i++;
        }
        Object serverObj = JOptionPane.showInputDialog(null, BlueSystem.getString("blueShare.selectServer.message"), BlueSystem.getString("blueShare.selectServer.title"), JOptionPane.PLAIN_MESSAGE, null, serverOptions, serverOptions[0]);
        if (serverObj != null) {
            retVal = serverObj.toString();
        }
    } catch (ParseException | HeadlessException e) {
        e.printStackTrace();
    }
    return retVal;
}
Also used : HeadlessException(java.awt.HeadlessException) Element(electric.xml.Element) ParseException(electric.xml.ParseException) Document(electric.xml.Document) Elements(electric.xml.Elements) File(java.io.File)

Example 4 with ParseException

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

the class BlueShareRemoteCaller method getInstrument.

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

Example 5 with ParseException

use of electric.xml.ParseException 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)

Aggregations

ParseException (electric.xml.ParseException)20 Document (electric.xml.Document)14 IOException (java.io.IOException)14 XmlRpcException (org.apache.xmlrpc.XmlRpcException)9 File (java.io.File)7 Element (electric.xml.Element)5 Vector (java.util.Vector)5 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)4 SoundObject (blue.soundObject.SoundObject)3 Elements (electric.xml.Elements)3 MissingResourceException (java.util.MissingResourceException)3 TreeNode (javax.swing.tree.TreeNode)3 Effect (blue.mixer.Effect)2 Instrument (blue.orchestra.Instrument)2 UDOLibrary (blue.udo.UDOLibrary)2 DefaultTreeModel (javax.swing.tree.DefaultTreeModel)2 InstrumentLibrary (blue.InstrumentLibrary)1 Library (blue.library.Library)1 EffectsLibrary (blue.ui.core.mixer.EffectsLibrary)1 EnvironmentVars (blue.utility.EnvironmentVars)1