javax.xml.xpath.XPathException Java Examples

The following examples show how to use javax.xml.xpath.XPathException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JAXBTest.java    From hyperjaxb3 with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void testMarshal() throws JAXBException, XPathException {
	final PurchaseOrderType purchaseOrder = objectFactory
			.createPurchaseOrderType();
	purchaseOrder.setShipTo(objectFactory.createUSAddress());
	purchaseOrder.getShipTo().setCity("New Orleans");
	final JAXBElement<PurchaseOrderType> purchaseOrderElement = objectFactory
			.createPurchaseOrder(purchaseOrder);

	final Marshaller marshaller = context.createMarshaller();

	final DOMResult result = new DOMResult();
	marshaller.marshal(purchaseOrderElement, result);

	final XPathFactory xPathFactory = XPathFactory.newInstance();

	assertEquals("Wrong city", "New Orleans", xPathFactory.newXPath()
			.evaluate("/purchaseOrder/shipTo/city", result.getNode()));
}
 
Example #2
Source File: XMLSchedulingDataProcessor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the xmlfile named <code>fileName</code> with the given system
 * ID.
 * 
 * @param fileName
 *          meta data file name.
 * @param systemId
 *          system ID.
 */
protected void processFile(String fileName, String systemId)
    throws ValidationException, ParserConfigurationException,
        SAXException, IOException, SchedulerException,
        ClassNotFoundException, ParseException, XPathException {

    prepForProcessing();
    
    log.info("Parsing XML file: " + fileName + 
            " with systemId: " + systemId);
    InputSource is = new InputSource(getInputStream(fileName));
    is.setSystemId(systemId);
    
    process(is);
    
    maybeThrowValidationException();
}
 
Example #3
Source File: WebXmlParser.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Parse the mime-mapping sections.
 *
 * @param webXml the web.xml to add to.
 * @param xPath the XPath to use.
 * @param node the node to use.
 */
private void parseMimeMappings(WebXml webXml, XPath xPath, Node node) {
    try {
        NodeList nodeList = (NodeList) xPath.evaluate("//mime-mapping", node, NODESET);
        if (nodeList != null) {
            List<WebXmlMimeMapping> mimeMappings = webXml.getMimeMappings();
            for (int i = 0; i < nodeList.getLength(); i++) {
                String extension = parseString(xPath, "//extension/text()", nodeList.item(i));
                String mimeType = parseString(xPath, "//mime-type/text()", nodeList.item(i));
                mimeMappings.add(new WebXmlMimeMapping(extension, mimeType));
            }
        }
    } catch (XPathException xpe) {
        LOGGER.log(WARNING, "Unable to parse <mime-mapping> sections", xpe);
    }
}
 
Example #4
Source File: WebXmlParser.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Parse the login-config section.
 *
 * @param webXml the web.xml to add to.
 * @param xPath the XPath to use.
 * @param node the DOM node.
 */
private void parseLoginConfig(WebXml webXml, XPath xPath, Node node) {
    try {
        Node configNode = (Node) xPath.evaluate("//login-config", node, NODE);
        if (configNode != null) {
            String authMethod = parseString(xPath,
                    "//auth-method/text()", configNode);
            String realmName = parseString(xPath,
                    "//realm-name/text()", configNode);
            String formLoginPage = parseString(xPath,
                    "//form-login-config/form-login-page/text()", configNode);
            String formErrorPage = parseString(xPath,
                    "//form-login-config/form-error-page/text()", configNode);
            WebXmlLoginConfig config = new WebXmlLoginConfig(
                    authMethod, realmName, formLoginPage, formErrorPage);
            webXml.setLoginConfig(config);
        }
    } catch (XPathException xpe) {
        LOGGER.log(WARNING, "Unable to parse <login-config> section", xpe);
    }
}
 
Example #5
Source File: XMLSchedulingDataProcessor.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Process the xmlfile named <code>fileName</code> with the given system
 * ID.
 * 
 * @param stream
 *          an input stream containing the xml content.
 * @param systemId
 *          system ID.
 */
public void processStreamAndScheduleJobs(InputStream stream, String systemId, Scheduler sched)
    throws ValidationException, ParserConfigurationException,
        SAXException, XPathException, IOException, SchedulerException,
        ClassNotFoundException, ParseException {

    prepForProcessing();

    log.info("Parsing XML from stream with systemId: " + systemId);

    InputSource is = new InputSource(stream);
    is.setSystemId(systemId);

    process(is);
    executePreProcessCommands(sched);
    scheduleJobs(sched);

    maybeThrowValidationException();
}
 
Example #6
Source File: WebXmlParser.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Parse the welcome file section.
 *
 * @param webXml the web.xml to add to.
 * @param xPath the XPath to use.
 * @param node the DOM node.
 */
private void parseWelcomeFiles(WebXml webXml, XPath xPath, Node node) {
    try {
        NodeList nodeList = (NodeList) xPath.evaluate("//welcome-file-list", node, NODESET);
        if (nodeList != null) {
            List<String> welcomeFiles = webXml.getWelcomeFiles();
            for (int i = 0; i < nodeList.getLength(); i++) {
                String welcomeFile = parseString(xPath, "welcome-file/text()", nodeList.item(i));
                welcomeFiles.add(welcomeFile);
                if (LOGGER.isLoggable(FINE)) {
                    LOGGER.log(FINE, "Parsed welcome-file: {0}", welcomeFile);
                }
            }
        }
    } catch (XPathException xpe) {
        LOGGER.log(WARNING, "Unable to parse <welcome-file-list> sections", xpe);
    }
}
 
Example #7
Source File: WebXmlParser.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Parse the error-page sections.
 *
 * @param webXml the web.xml to add to.
 * @param xPath the XPath to use.
 * @param node the DOM node.
 */
private void parseErrorPages(WebXml webXml, XPath xPath, Node node) {
    try {
        NodeList nodeList = (NodeList) xPath.evaluate("//error-page", node, NODESET);
        if (nodeList != null) {
            List<WebXmlErrorPage> errorPages = webXml.getErrorPages();
            for (int i = 0; i < nodeList.getLength(); i++) {
                String errorCode = parseString(xPath, "error-code/text()", nodeList.item(i));
                String exceptionType = parseString(xPath, "exception-type/text()", nodeList.item(i));
                String location = parseString(xPath, "location/text()", nodeList.item(i));
                errorPages.add(new WebXmlErrorPage(errorCode, exceptionType, location));
            }
        }
    } catch (XPathException xpe) {
        LOGGER.log(WARNING, "Unable to parse <error-page> sections", xpe);
    }
}
 
Example #8
Source File: WebXmlParser.java    From piranha with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Parse the session-config section.
 *
 * @param webXml the web.xml to add to.
 * @param xPath the XPath to use.
 * @param node the DOM node.
 */
private void parseSessionConfig(WebXml webXml, XPath xPath, Node node) {
    try {
        Node scNode = (Node) xPath.evaluate("session-config", node, NODE);
        if (scNode != null) {
            WebXmlSessionConfig sessionConfig = new WebXmlSessionConfig();
            int sessionTimeout = parseInteger(
                    xPath, "session-timeout/text()", scNode);
            sessionConfig.setSessionTimeout(sessionTimeout);
            webXml.setSessionConfig(sessionConfig);
            Node cNode = (Node) xPath.evaluate("cookie-config", scNode, NODE);
            if (cNode != null) {
                WebXmlCookieConfig cookieConfig = new WebXmlCookieConfig();
                String name = parseString(xPath, "name/text()", cNode);
                if (name != null) {
                    cookieConfig.setName(name);
                }
            }
        }
    } catch (XPathException xpe) {
        LOGGER.log(WARNING, "Unable to parse <session-config> section", xpe);
    }
}
 
Example #9
Source File: AutoProvisionJobs.java    From sakai with Educational Community License v2.0 6 votes vote down vote up
public void init() throws ParserConfigurationException, XPathException, ParseException, IOException, ValidationException, SchedulerException, SAXException, ClassNotFoundException {

        boolean noFiles = files == null || files.isEmpty();
        if (noFiles || !schedulerManager.isAutoProvisioning()) {
            log.info("Not auto provisioning jobs: "+ ((noFiles)?"no files.":String.join(", ", files)));
            return;
        }

        Scheduler scheduler = schedulerManager.getScheduler();
        ClassLoadHelper clh = new CascadingClassLoadHelper();
        clh.initialize();

        for (String file : files ) {
            XMLSchedulingDataProcessor proc = new XMLSchedulingDataProcessor(clh);
            InputStream in = getClass().getResourceAsStream(file);
            if (in == null) {
                throw new IllegalArgumentException("Couldn't find resource on classpath: "+ file);
            }
            try {
                proc.processStreamAndScheduleJobs(in, file, scheduler);
                log.info("Successfully provisioned jobs/triggers from :"+ file);
            } catch (ObjectAlreadyExistsException e) {
                log.info("Not fully processing: "+ file+ " because some parts already exist");
            }
        }
    }
 
Example #10
Source File: XMLSchedulingDataProcessor.java    From AsuraFramework with Apache License 2.0 6 votes vote down vote up
/**
 * Process the xmlfile named <code>fileName</code> with the given system
 * ID.
 * 
 * @param fileName
 *          meta data file name.
 * @param systemId
 *          system ID.
 */
protected void processFile(String fileName, String systemId)
    throws ValidationException, ParserConfigurationException,
        SAXException, IOException, SchedulerException,
        ClassNotFoundException, ParseException, XPathException {

    prepForProcessing();
    
    log.info("Parsing XML file: " + fileName + 
            " with systemId: " + systemId);
    InputSource is = new InputSource(getInputStream(fileName));
    is.setSystemId(systemId);
    
    process(is);
    
    maybeThrowValidationException();
}
 
Example #11
Source File: MergeDocuments.java    From secure-data-service with Apache License 2.0 6 votes vote down vote up
/**
 * Starts the merge process
 *
 * @param mainDoc  The document to edit.
 * @param mergeDoc The document containing the edit instructions.
 * @throws XPathException A problem parsing the XPath location.
 */
protected void applyMerge(Document mainDoc, Document mergeDoc) throws XPathException {
    NodeList mergeActions = handler.getNodeList(mergeDoc, BASE_XPATH_EXPR);

    for (int i = 0; i < mergeActions.getLength(); i++) {
        Node node = mergeActions.item(i);

        // get the attribute map and action information
        NamedNodeMap attrMap = node.getAttributes();
        String type = attrMap.getNamedItem(ATTR_TYPE).getNodeValue();
        String action = attrMap.getNamedItem(ATTR_ACTION).getNodeValue();
        String xpath = attrMap.getNamedItem(ATTR_XPATH).getNodeValue();
        NodeList actionArgs = node.getChildNodes();

        // perform the transform
        performTransform(mainDoc, type, action, xpath, actionArgs);
    }
}
 
Example #12
Source File: XPathExceptionInitCause.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
static byte [] pickleXPE(XPathException xpe) throws IOException {
    ByteArrayOutputStream bos =  new ByteArrayOutputStream();
    ObjectOutputStream xpeos = new ObjectOutputStream(bos);
    xpeos.writeObject(xpe);
    xpeos.close();
    return bos.toByteArray();
}
 
Example #13
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadZLEMAIndicator(String key) throws XPathException{
    int ZLEMAIndicator_1 = Integer.parseInt(parameter.getParameter(key, "Time Frame"));
    XYLineAndShapeRenderer renderer = createRenderer(key, "Color", "Shape", "Stroke");
    IndicatorCategory category = parameter.getCategory(key);
    ChartType chartType = parameter.getChartType(key);
    addChartIndicator(key,
            new ZLEMAIndicator(closePriceIndicator.get(), ZLEMAIndicator_1),String.format("%s [%s] (%s)",
                    getIdentifier(key), getID(key),ZLEMAIndicator_1), renderer, chartType.toBoolean(), category);
}
 
Example #14
Source File: XPathExceptionInitCause.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
static byte [] pickleXPE(XPathException xpe) throws IOException {
    ByteArrayOutputStream bos =  new ByteArrayOutputStream();
    ObjectOutputStream xpeos = new ObjectOutputStream(bos);
    xpeos.writeObject(xpe);
    xpeos.close();
    return bos.toByteArray();
}
 
Example #15
Source File: XMLDog.java    From jlibs with Apache License 2.0 5 votes vote down vote up
public XPathResults sniff(InputSource source) throws XPathException{
    Event event = createEvent();
    XPathResults results = new XPathResults(event);
    event.setListener(results);
    sniff(event, source);
    return results;
}
 
Example #16
Source File: XMLDog.java    From jlibs with Apache License 2.0 5 votes vote down vote up
public void sniff(Event event, InputSource source, boolean useSTAX) throws XPathException{
    XMLReader reader;
    try{
        if(useSTAX)
            reader = new STAXXMLReader();
        else
            reader = SAXUtil.newSAXFactory(true, false, false).newSAXParser().getXMLReader();
        sniff(event, source, reader);
    }catch(Exception ex){
        throw new XPathException(ex);
    }
}
 
Example #17
Source File: XMLDog.java    From jlibs with Apache License 2.0 5 votes vote down vote up
public XPathResults sniff(InputSource source, boolean useSTAX) throws XPathException{
    Event event = createEvent();
    XPathResults results = new XPathResults(event);
    event.setListener(results);
    sniff(event, source, useSTAX);
    return results;
}
 
Example #18
Source File: BeerXMLReader.java    From SB_Elsinore_Server with MIT License 5 votes vote down vote up
/**
 * Add a mash Profile to a recipe.
 * @param recipe The @{Recipe} object to add the mash profile to.
 * @param mashProfile The node containing the beerXML Mash element.
 * @param xp an XPath object to use to run XPath expressions.
 * @throws XPathException If an XPath expression could not be run.
 */
private void parseMashProfile(Recipe recipe, Node mashProfile, XPath xp) throws XPathException {
    String name = getString(mashProfile, "NAME", xp);
    double grainTemp = getDouble(mashProfile, "GRAIN_TEMP", xp);
    Node mashSteps = (Node) xp.evaluate("MASH_STEPS", mashProfile, XPathConstants.NODE);
    String notes = getString(mashProfile, "NOTES", xp);
    double tunTemp = getDouble(mashProfile, "TUN_TEMP", xp);
    double spargeTemp = getDouble(mashProfile, "SPARGE_TEMP", xp);
    double ph = getDouble(mashProfile, "PH", xp);
    double tunWeight = getDouble(mashProfile, "TUN_WEIGHT", xp);
    double tunSpecificHeat = getDouble(mashProfile, "TUN_SPECIFIC_HEAT", xp);
    boolean tunAdjust = getBoolean(mashProfile, "TUN_ADJUST", xp, false);

    Mash mash = recipe.getMash();
    if (mash == null) {
        mash = new Mash(name, recipe);
        recipe.setMash(mash);
    } else {
        mash.setName(name);
    }

    mash.setGrainTemp(grainTemp);
    mash.setNotes(notes);
    mash.setTunTemp(tunTemp);
    mash.setSpargeTemp(spargeTemp);
    mash.setPh(ph);
    mash.setTunWeight(tunWeight);
    mash.setTunSpecificHeat(tunSpecificHeat);
    mash.setTunAdjust(tunAdjust);
    mash.setTunWeight(getString(mashProfile, "DISPLAY_TUN_WEIGHT", xp));
    mash.setMashTempUnits(getString(mashProfile, "DISPLAY_GRAIN_TEMP", xp));

    parseMashSteps(mash, mashSteps, xp);
}
 
Example #19
Source File: HCalendarParser.java    From cosmo with Apache License 2.0 5 votes vote down vote up
/**
 * Finds nodes.
 * @param expr The XPath expression.
 * @param context The context object.
 * @return The node.
 * @throws ParserException - if something is wrong this exception is thrown.
 */
private static Node findNode(XPathExpression expr, Object context) throws ParserException {
    try {
        return (Node) expr.evaluate(context, XPathConstants.NODE);
    } catch (XPathException e) {
        throw new ParserException("Unable to find node", -1, e);
    }
}
 
Example #20
Source File: XPathExceptionInitCause.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
static byte [] pickleXPE(XPathException xpe) throws IOException {
    ByteArrayOutputStream bos =  new ByteArrayOutputStream();
    ObjectOutputStream xpeos = new ObjectOutputStream(bos);
    xpeos.writeObject(xpe);
    xpeos.close();
    return bos.toByteArray();
}
 
Example #21
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadKAMAIndicator(String key) throws XPathException{
    int timeFrameEffRatio = Integer.parseInt(parameter.getParameter(key, "Time Frame Effective Ratio"));
    int timeFrameFast = Integer.parseInt(parameter.getParameter(key, "Time Frame Slow"));
    int timeFrameSlow = Integer.parseInt(parameter.getParameter(key, "Time Frame Fast"));
    XYLineAndShapeRenderer renderer = createRenderer(key, "Color", "Shape", "Stroke");
    IndicatorCategory category = parameter.getCategory(key);
    ChartType chartType = parameter.getChartType(key);

    addChartIndicator(key,new KAMAIndicator(closePriceIndicator.get(),timeFrameEffRatio,timeFrameFast,timeFrameSlow),
            String.format("%s [%s] (%s, %s, %s)",getIdentifier(key), getID(key), timeFrameEffRatio, timeFrameFast, timeFrameSlow),
            renderer,chartType.toBoolean(), category);
}
 
Example #22
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadWMAIndicator(String key) throws XPathException{
    int timeFrame = Integer.parseInt(parameter.getParameter(key, "Time Frame"));
    XYLineAndShapeRenderer renderer = createRenderer(key, "Color", "Shape", "Stroke");
    IndicatorCategory category = parameter.getCategory(key);
    ChartType chartType = parameter.getChartType(key);
    addChartIndicator(key, new WMAIndicator(closePriceIndicator.get(), timeFrame),String.format("%s [%s] (%s)",
            getIdentifier(key), getID(key), timeFrame),renderer, chartType.toBoolean(), category);
}
 
Example #23
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadUlcerIndexIndicator(String key) throws XPathException{
    XYLineAndShapeRenderer renderer = createRenderer(key, "Color", "Shape", "Stroke");
    int timeFrame = Integer.parseInt(parameter.getParameter(key, "Time Frame"));
    IndicatorCategory category = parameter.getCategory(key);
    ChartType chartType = parameter.getChartType(key);
    addChartIndicator(key, new UlcerIndexIndicator(closePriceIndicator.get(), timeFrame),
            String.format("%s [%s]", getIdentifier(key), getID(key)),renderer, chartType.toBoolean(), category);
}
 
Example #24
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadTrippleEMAIndicator(String key) throws XPathException{
    int timeFrame =Integer.parseInt(parameter.getParameter(key, "Time Frame"));

    ChartType chartType = parameter.getChartType(key);
    IndicatorCategory category = parameter.getCategory(key);
    XYLineAndShapeRenderer xyLineAndShapeRenderer = createRenderer(key, "Color", "Shape", "Stroke");
    addChartIndicator(key,
            new TripleEMAIndicator(closePriceIndicator.get(), timeFrame),
            String.format("%s [%s] (%s)", getIdentifier(key), getID(key), timeFrame),
            xyLineAndShapeRenderer,
            chartType.toBoolean(),
            category);
}
 
Example #25
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadAroonUP_DOWN(String key) throws XPathException{
    int arronUp = Integer.parseInt(parameter.getParameter(key, "Time Frame Up"));
    int arronDown = Integer.parseInt(parameter.getParameter(key, "Time Frame Down"));
    Color colorD = ConverterUtils.ColorAWTConverter.fromString(parameter.getParameter(key, "Color Down"));
    StrokeType strokeD = StrokeType.valueOf(parameter.getParameter(key, "Stroke Down"));
    ShapeType shapeD = ShapeType.valueOf(parameter.getParameter(key, "Shape Down"));
    ChartType chartType = parameter.getChartType(key);
    IndicatorCategory category = parameter.getCategory(key);

    List<Indicator> ilAroon = new ArrayList<>();
    List<String> nlAroon = new ArrayList<>();
    ilAroon.add(new AroonDownIndicator(series.get(), arronDown));
    ilAroon.add(new AroonUpIndicator(series.get(), arronUp));
    nlAroon.add("Aroon Down "+arronDown);
    nlAroon.add("Aroon Up "+arronUp);
    XYLineAndShapeRenderer arronUpDownRenderer = createRenderer(key, "Color Up", "Shape Up", "Stroke Up");

    arronUpDownRenderer.setSeriesPaint(1, colorD);
    arronUpDownRenderer.setSeriesStroke(1, strokeD.stroke);
    arronUpDownRenderer.setSeriesShape(1, shapeD.shape);

    addChartIndicator(key,
            ilAroon,
            nlAroon,String.format("%s [%s] (%s, %s)",getIdentifier(key), getID(key),arronUp, arronDown),
            arronUpDownRenderer,
            chartType.toBoolean(),
            category);
}
 
Example #26
Source File: BeerXMLReader.java    From SB_Elsinore_Server with MIT License 5 votes vote down vote up
public Recipe[] readRecipe(Document beerDocument, String name) throws XPathException {
    String recipeSelector = "";

    if (name != null) {
        recipeSelector = "[NAME[text()=\"" + name + "\"]]";
    }

    XPath xp = XPathFactory.newInstance().newXPath();
    NodeList recipeData =
            (NodeList) xp.evaluate(
                    "/RECIPES/RECIPE" + recipeSelector,
                    beerDocument, XPathConstants.NODESET);

    Recipe recipeList[] = new Recipe[recipeData.getLength()];
    for (int i = 0; i < recipeData.getLength(); i++) {
        try {
            recipeList[i] = readSingleRecipe(recipeData.item(i));
        } catch (XPathException xpe) {
            BrewServer.LOG.warning("Couldn't read the recipe at index "
                    + i + " - " + xpe.getMessage());
            xpe.printStackTrace();
        } catch (NumberFormatException nfe) {
            BrewServer.LOG.warning("Couldn't read the recipe at index "
                    + i + " due to a bad number " + nfe.getMessage());
            nfe.printStackTrace();
        }
    }
    return recipeList;
}
 
Example #27
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
public void loadPercentBIndicator(String key) throws XPathException{
    int timeFrame =Integer.parseInt(parameter.getParameter(key, "Time Frame"));
    double k = Double.valueOf(parameter.getParameter(key,"K Multiplier"));
    XYLineAndShapeRenderer renderer = createRenderer(key, "Color", "Shape", "Stroke");
    IndicatorCategory category = parameter.getCategory(key);
    ChartType type = parameter.getChartType(key);
    addChartIndicator(key,
            new PercentBIndicator(closePriceIndicator.get(), timeFrame, k),
            String.format("%s [%s] (%s, %s)",getIdentifier(key),getID(key),timeFrame,k),
            renderer,
            type.toBoolean(),
            category);

}
 
Example #28
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void loadCMOIndicator(String key)throws XPathException{
    int timeFrame = Integer.parseInt(parameter.getParameter(key,"Time Frame"));
    Color color = ConverterUtils.ColorAWTConverter.fromString(parameter.getParameter(key, "Color"));
    StrokeType stroke = StrokeType.valueOf(parameter.getParameter(key, "Stroke"));
    ShapeType shape = ShapeType.valueOf(parameter.getParameter(key,"Shape"));
    ChartType chartType = ChartType.valueOf(parameter.getParameter(key, "Chart Type"));
    IndicatorCategory category = parameter.getCategory(key);

    addChartIndicator(key, new CMOIndicator(closePriceIndicator.get(), timeFrame),
            String.format("%s [%s] (%s)",getIdentifier(key), getID(key), timeFrame),
            createRenderer(color, stroke, shape),
            chartType.toBoolean(),
            category);
}
 
Example #29
Source File: XPathExceptionInitCause.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
static byte [] pickleXPE(XPathException xpe) throws IOException {
    ByteArrayOutputStream bos =  new ByteArrayOutputStream();
    ObjectOutputStream xpeos = new ObjectOutputStream(bos);
    xpeos.writeObject(xpe);
    xpeos.close();
    return bos.toByteArray();
}
 
Example #30
Source File: BaseIndicatorBox.java    From TAcharting with GNU Lesser General Public License v2.1 5 votes vote down vote up
private void loadEMAIndicator(String key)throws XPathException {
    int timeFrame = Integer.parseInt(parameter.getParameter(key,"Time Frame"));
    Color color = ConverterUtils.ColorAWTConverter.fromString(parameter.getParameter(key, "Color"));
    StrokeType stroke = StrokeType.valueOf(parameter.getParameter(key, "Stroke"));
    ShapeType shape = ShapeType.valueOf(parameter.getParameter(key,"Shape"));
    ChartType chartType = parameter.getChartType(key);
    IndicatorCategory category = parameter.getCategory(key);

    addChartIndicator(key, new EMAIndicator(closePriceIndicator.get(), timeFrame),
            String.format("%s [%s] (%s)",getIdentifier(key),getID(key),timeFrame),
            createRenderer(color, stroke, shape),
            chartType.toBoolean(),
            category);
}