/** * Updates Job by its XML definition. * * @since 1.526 */ public void updateByXml(final InputStream source) throws IOException, ServletException { checkPermission(CONFIGURE); Node result = (Node)Jenkins.XSTREAM2.fromXML(source); Jenkins.getInstance().getNodesObject().replaceNode(this.getNode(), result); }
@Override protected int run() throws Exception { final Jenkins jenkins = Jenkins.getActiveInstance(); jenkins.checkPermission(Computer.CREATE); final Node newNode = (Node) Jenkins.XSTREAM2.fromXML(stdin); if (nodeName != null) { // Using deprecated method but it's contract is preserved newNode.setNodeName(nodeName); } if(newNode instanceof Slave) { //change userId too User user = User.current(); ((Slave) newNode).setUserId(user==null ? "anonymous" : user.getId()); } if (jenkins.getNode(newNode.getNodeName()) != null) { throw new IllegalStateException("Node '" + newNode.getNodeName() + "' already exists"); } jenkins.addNode(newNode); return 0; }
/** * Convert xml fragment into a BuildSelector object. * @param xml XML fragment to parse. * @return the BuildSelector represented by the input XML. * @throws XStreamException if the object cannot be deserialized * @throws ClassCastException if input is invalid */ public static BuildSelector getSelectorFromXml(String xml) { return (BuildSelector)XSTREAM.fromXML(xml); }
is = new GZIPInputStream(is); Object obj = Jenkins.XSTREAM2.fromXML(is);
is = new GZIPInputStream(is); Object obj = Jenkins.XSTREAM2.fromXML(is);
String xml = Jenkins.XSTREAM2.toXML(trigger); if (xml == null) { return trigger; } Object copy = Jenkins.XSTREAM2.fromXML(xml); if (copy == null || !(copy instanceof Trigger)) { return trigger;
String xml = Jenkins.XSTREAM2.toXML(trigger); if (xml == null) { return trigger; } Object copy = Jenkins.XSTREAM2.fromXML(xml); if (copy == null || !(copy instanceof Trigger)) { return trigger;
/** * Updates Job by its XML definition. * * @since 1.526 */ public void updateByXml(final InputStream source) throws IOException, ServletException { checkPermission(CONFIGURE); Node result = (Node)Jenkins.XSTREAM2.fromXML(source); Jenkins.getInstance().getNodesObject().replaceNode(this.getNode(), result); }
timestamp); final Slave newSlave = (Slave) Jenkins.XSTREAM2 .fromXML(xmlFile.getFile()); final List<Node> nodes = new ArrayList<Node>(); nodes.addAll(jenkins.getNodes());
@Override protected int run() throws Exception { final Jenkins jenkins = Jenkins.getActiveInstance(); jenkins.checkPermission(Computer.CREATE); final Node newNode = (Node) Jenkins.XSTREAM2.fromXML(stdin); if (nodeName != null) { // Using deprecated method but it's contract is preserved newNode.setNodeName(nodeName); } if(newNode instanceof Slave) { //change userId too User user = User.current(); ((Slave) newNode).setUserId(user==null ? "anonymous" : user.getId()); } if (jenkins.getNode(newNode.getNodeName()) != null) { throw new IllegalStateException("Node '" + newNode.getNodeName() + "' already exists"); } jenkins.addNode(newNode); return 0; }
Object obj = Items.XSTREAM2.fromXML(selfXml); if (!(obj instanceof InheritanceProject)) { throw new HttpStatusException(