Java Code Examples for org.jaxen.SimpleNamespaceContext

The following are top voted examples for showing how to use org.jaxen.SimpleNamespaceContext. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: scribe   File: SOAPExecutor.java   Source Code and License 12 votes vote down vote up
/**
 * Constructs XPath query over the SOAP message
 * 
 * @param query XPath query
 * @param response SOAP message
 * @return XPath query
 * @throws SOAPException in case of SOAP issue
 * @throws JaxenException XPath problem
 */
public final XPath createXPath(final String query, final SOAPMessage response) throws SOAPException, JaxenException {

  /* Uses DOM to XPath mapping */
  final XPath xpath = new DOMXPath(query);

  /* Define a namespaces used in response */
  final SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
  final SOAPPart sp = response.getSOAPPart();
  final SOAPEnvelope env = sp.getEnvelope();
  final SOAPBody bdy = env.getBody();

  /* Add namespaces from SOAP envelope */
  addNamespaces(nsContext, env);

  /* Add namespaces of top body element */
  final Iterator<?> bodyElements = bdy.getChildElements();
  while (bodyElements.hasNext()) {
    SOAPElement element = (SOAPElement) bodyElements.next();
    addNamespaces(nsContext, element);
  }
  xpath.setNamespaceContext(nsContext);
  return xpath;
}
 
Example 2
Project: joai-project   File: InfoXML.java   Source Code and License 7 votes vote down vote up
private Element getTagElement (String _tag, String _namespacePrefix, String _namespaceURI ) {
	
	Element tagElement = null; // caller is responsible for handling null
	
	try {
		// TODO  this isn't complete, as we can have any arbitrary tag and values for them infinitely deep
		XPath xpath = DocumentHelper.createXPath( "//" + ( _namespacePrefix != null ? _namespacePrefix + ":" : "" ) + _tag.trim() );
		SimpleNamespaceContext ns = new SimpleNamespaceContext();
		ns.addNamespace( _namespacePrefix, _namespaceURI );  
		xpath.setNamespaceContext(ns);

		tagElement = ((Element)xpath.selectSingleNode(this.infoxmlDoc));
		
	}  catch ( Exception e ) {
		e.printStackTrace();
	}
	
	return tagElement;		
}
 
Example 3
Project: joai-project   File: NdrObjectReader.java   Source Code and License 6 votes vote down vote up
/**
 *  Returns a namespace context instance, containing namespaces occuring in NDR
 *  objects, that is used in xpath operations.
 *
 * @return    The nsContext value
 */
protected SimpleNamespaceContext getNsContext() {
	if (this.nsContext == null) {
		this.nsContext = new SimpleNamespaceContext();

		Namespace NDR_RESPONSE_NAMESPACE =
			DocumentHelper.createNamespace("ndr", "http://ns.nsdl.org/ndr/response_v1.00/");

		nsContext.addNamespace(NDR_RESPONSE_NAMESPACE.getPrefix(),
			NDR_RESPONSE_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.AUTH_NAMESPACE.getPrefix(),
			NDRConstants.AUTH_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.NCS_NAMESPACE.getPrefix(),
			NDRConstants.NCS_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.FEDORA_VIEW_NAMESPACE.getPrefix(),
			NDRConstants.FEDORA_VIEW_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.FEDORA_MODEL_NAMESPACE.getPrefix(),
			NDRConstants.FEDORA_MODEL_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.NSDL_NAMESPACE.getPrefix(),
			NDRConstants.NSDL_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.OAI_NAMESPACE.getPrefix(),
			NDRConstants.OAI_NAMESPACE.getURI());
	}
	return nsContext;
}
 
Example 4
Project: carbon-identity-framework   File: XmlConfiguration.java   Source Code and License 6 votes vote down vote up
public String getUniqueValue(String xPath) {
    SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
    nsCtx.addNamespace("ns", serverNamespace);
    try {
        XPath xp = new AXIOMXPath(xPath);
        xp.setNamespaceContext(nsCtx);
        OMElement elem = builder.getDocumentElement();
        if (elem != null) {
            List nodeList = xp.selectNodes(elem);
            Object obj;
            if (!nodeList.isEmpty() && ((obj = nodeList.get(0)) != null)) {
                return ((OMElement) obj).getText();
            }
        }
    } catch (JaxenException e) {
        throw new RuntimeException("XPath expression " + xPath + " failed", e);
    }
    return null;
}
 
Example 5
Project: carbon-identity-framework   File: XmlConfiguration.java   Source Code and License 6 votes vote down vote up
public OMElement[] getElements(String xPath) {
    SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
    nsCtx.addNamespace("ns", serverNamespace);
    try {
        XPath xp = new AXIOMXPath(xPath);
        xp.setNamespaceContext(nsCtx);
        OMElement elem = builder.getDocumentElement();
        if (elem != null) {
            List nodeList = xp.selectNodes(elem);
            return (OMElement[]) nodeList.toArray(new OMElement[nodeList.size()]);
        }
    } catch (JaxenException e) {
        throw new RuntimeException("XPath expression " + xPath + " failed", e);
    }
    return new OMElement[0];
}
 
Example 6
Project: dls-repository-stack   File: NdrObjectReader.java   Source Code and License 6 votes vote down vote up
/**
 *  Returns a namespace context instance, containing namespaces occuring in NDR
 *  objects, that is used in xpath operations.
 *
 * @return    The nsContext value
 */
protected SimpleNamespaceContext getNsContext() {
	if (this.nsContext == null) {
		this.nsContext = new SimpleNamespaceContext();

		Namespace NDR_RESPONSE_NAMESPACE =
			DocumentHelper.createNamespace("ndr", "http://ns.nsdl.org/ndr/response_v1.00/");

		nsContext.addNamespace(NDR_RESPONSE_NAMESPACE.getPrefix(),
			NDR_RESPONSE_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.AUTH_NAMESPACE.getPrefix(),
			NDRConstants.AUTH_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.NCS_NAMESPACE.getPrefix(),
			NDRConstants.NCS_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.FEDORA_VIEW_NAMESPACE.getPrefix(),
			NDRConstants.FEDORA_VIEW_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.FEDORA_MODEL_NAMESPACE.getPrefix(),
			NDRConstants.FEDORA_MODEL_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.NSDL_NAMESPACE.getPrefix(),
			NDRConstants.NSDL_NAMESPACE.getURI());
		nsContext.addNamespace(NDRConstants.OAI_NAMESPACE.getPrefix(),
			NDRConstants.OAI_NAMESPACE.getURI());
	}
	return nsContext;
}
 
Example 7
Project: dls-repository-stack   File: InfoXML.java   Source Code and License 6 votes vote down vote up
private Element getTagElement (String _tag, String _namespacePrefix, String _namespaceURI ) {
	
	Element tagElement = null; // caller is responsible for handling null
	
	try {
		// TODO  this isn't complete, as we can have any arbitrary tag and values for them infinitely deep
		XPath xpath = DocumentHelper.createXPath( "//" + ( _namespacePrefix != null ? _namespacePrefix + ":" : "" ) + _tag.trim() );
		SimpleNamespaceContext ns = new SimpleNamespaceContext();
		ns.addNamespace( _namespacePrefix, _namespaceURI );  
		xpath.setNamespaceContext(ns);

		tagElement = ((Element)xpath.selectSingleNode(this.infoxmlDoc));
		
	}  catch ( Exception e ) {
		e.printStackTrace();
	}
	
	return tagElement;		
}
 
Example 8
Project: jaxen   File: BaseXPathTest.java   Source Code and License 6 votes vote down vote up
public void testJaxen107() throws JaxenException {
    
    org.w3c.dom.Element a = doc.createElementNS("http://www.a.com/", "a:foo");
    doc.appendChild(a);
    Element b = doc.createElementNS("http://www.b.com/", "b:bar");
    a.appendChild(b);
    
    XPath xpath = new DOMXPath("/a:foo/b:bar/namespace::*/parent::*");
    SimpleNamespaceContext context1 = new SimpleNamespaceContext();
    context1.addNamespace("a", "http://www.a.com/");
    context1.addNamespace("b", "http://www.b.com/");
    xpath.setNamespaceContext(context1);
    List result = xpath.selectNodes(doc);
    assertEquals(1, result.size());
    assertEquals(b, result.get(0));
   
}
 
Example 9
Project: jaxen   File: SimpleNamespaceContextTest.java   Source Code and License 6 votes vote down vote up
public void testSerialization() throws IOException, ClassNotFoundException {
    
    // construct test object
    SimpleNamespaceContext original = new SimpleNamespaceContext();
    original.addNamespace("a", "http://www.a.com");
    original.addNamespace("b", "http://www.b.com");
    
    // serialize
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    ObjectOutputStream oos = new ObjectOutputStream(out);
    oos.writeObject(original);
    oos.close();
    
    //deserialize
    byte[] pickled = out.toByteArray();
    InputStream in = new ByteArrayInputStream(pickled);
    ObjectInputStream ois = new ObjectInputStream(in);
    Object o = ois.readObject();
    SimpleNamespaceContext copy = (SimpleNamespaceContext) o;
    
    // test the result
    assertEquals("http://www.a.com", copy.translateNamespacePrefixToUri("a"));
    assertEquals("http://www.b.com", copy.translateNamespacePrefixToUri("b"));
    assertEquals("", "");
    
}
 
Example 10
Project: carbon-identity   File: XmlConfiguration.java   Source Code and License 6 votes vote down vote up
public String getUniqueValue(String xPath) {
    SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
    nsCtx.addNamespace("ns", serverNamespace);
    try {
        XPath xp = new AXIOMXPath(xPath);
        xp.setNamespaceContext(nsCtx);
        OMElement elem = builder.getDocumentElement();
        if (elem != null) {
            List nodeList = xp.selectNodes(elem);
            Object obj;
            if (!nodeList.isEmpty() && ((obj = nodeList.get(0)) != null)) {
                return ((OMElement) obj).getText();
            }
        }
    } catch (JaxenException e) {
        throw new RuntimeException("XPath expression " + xPath + " failed", e);
    }
    return null;
}
 
Example 11
Project: carbon-identity   File: XmlConfiguration.java   Source Code and License 6 votes vote down vote up
public OMElement[] getElements(String xPath) {
    SimpleNamespaceContext nsCtx = new SimpleNamespaceContext();
    nsCtx.addNamespace("ns", serverNamespace);
    try {
        XPath xp = new AXIOMXPath(xPath);
        xp.setNamespaceContext(nsCtx);
        OMElement elem = builder.getDocumentElement();
        if (elem != null) {
            List nodeList = xp.selectNodes(elem);
            return (OMElement[]) nodeList.toArray(new OMElement[nodeList.size()]);
        }
    } catch (JaxenException e) {
        throw new RuntimeException("XPath expression " + xPath + " failed", e);
    }
    return new OMElement[0];
}
 
Example 12
Project: community-edition-old   File: CreateWorkspaceEndpoint.java   Source Code and License 6 votes vote down vote up
/**
 * Create new Meeting Workspace on Alfresco server
 */
@Override
protected void executeWorkspaceAction(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
        Element requestElement, SimpleNamespaceContext nc, String siteName, String title, String templateName,
        int lcid) throws Exception
{
    // A title is required
    if (title == null || title.length() == 0)
    {
        throw new RuntimeException("Site name is not specified. Please fill up subject field.");
    }

    // Have the site created
    siteName = handler.createWorkspace(title, templateName, lcid, getTimeZoneInformation(requestElement),
            (SessionUser) soapRequest.getSession().getAttribute(SharepointConstants.USER_SESSION_ATTRIBUTE));

    // Create the soap response
    Element workspace = buildWorkspaceResponse(soapResponse);
    workspace.addAttribute("Url", getHost(soapRequest) + soapRequest.getAlfrescoContextName() + "/" + siteName);
}
 
Example 13
Project: community-edition-old   File: DeleteWorkspaceEndpoint.java   Source Code and License 6 votes vote down vote up
@Override
protected void executeWorkspaceAction(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
        Element requestElement, SimpleNamespaceContext nc, String siteName, String title, String templateName,
        int lcid) throws Exception
{
    // Perform the deletion
    try
    {
        handler.deleteWorkspace(siteName, (SessionUser) soapRequest.getSession().getAttribute(SharepointConstants.USER_SESSION_ATTRIBUTE));
    }
    catch (SiteDoesNotExistException se)
    {
        throw new VtiSoapException("vti.meeting.error.no_site", 0x4l); // TODO Is this the right code?
    }
    catch (SiteTypeException ste)
    {
        throw new VtiSoapException(ste.getMsgId(), 0x4l);
    }

    // Create the soap response
    soapResponse.setContentType("text/xml");
    soapResponse.getDocument().addElement("DeleteWorkspaceResponse", namespace);
}
 
Example 14
Project: community-edition-old   File: SetWorkspaceTitleEndpoint.java   Source Code and License 6 votes vote down vote up
@Override
protected void executeWorkspaceAction(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
        Element requestElement, SimpleNamespaceContext nc, String siteName, String title, String templateName,
        int lcid) throws Exception
{
    // If no new title is given, then an empty string is used
    if (title == null)
    {
        title = "";
    }

    // Update the title
    try
    {
        handler.updateWorkspaceTitle(siteName, title);
    }
    catch (SiteDoesNotExistException e)
    {
        throw new VtiSoapException("Site '" + siteName + "' not found", 6l);
    }

    // Create the soap response
    soapResponse.setContentType("text/xml");
    soapResponse.getDocument().addElement("SetWorkspaceTitleResponse", namespace);
}
 
Example 15
Project: community-edition-old   File: TestAbstractListItemsEndpointTest.java   Source Code and License 6 votes vote down vote up
/**
 * ALF-19833: MacOS: Could not save to SharePoint
 */
@Test
public void canGetListUsingCorrectListAndSiteName() throws Exception
{
    VtiSoapRequest soapRequest = Mockito.mock(VtiSoapRequest.class);
    VtiSoapResponse soapResponse = new VtiSoapResponse(new MockHttpServletResponse());//Mockito.mock(VtiSoapResponse.class);
    Element requestElement = Mockito.mock(Element.class);
    SimpleNamespaceContext nc = Mockito.mock(SimpleNamespaceContext.class);

    Element rootElement = new DefaultElement(QName.get("root", "lists", "some://uri"));
    when(soapRequest.getDocument()).thenReturn(new DefaultDocument(rootElement));
    
    // Invoke the method under test.
    listItemsEndpoint.executeListActionDetails(soapRequest, soapResponse,
                "my-site", "documentLibrary", requestElement, nc);
    
    // Check the condition this test is for.
    verify(listHandler).getList("documentLibrary", "my-site");
}
 
Example 16
Project: carbon-governance   File: CommonUtil.java   Source Code and License 6 votes vote down vote up
public static String getVersionFromContent(OMElement content) {
    try {
        AXIOMXPath xPath = new AXIOMXPath("//pre:version");
        SimpleNamespaceContext context = new SimpleNamespaceContext();
        context.addNamespace("pre", content.getNamespace().getNamespaceURI());
        xPath.setNamespaceContext(context);

        List versionElements = xPath.selectNodes(content);

        if (versionElements != null) {
            for (Object versionElement : versionElements) {
                OMElement version = (OMElement) versionElement;
                if (((OMElement) version.getParent()).getLocalName().equals("overview")) {
                    return version.getText();
                }
            }
        }

    } catch (JaxenException e) {
        log.error("Unable to get the version of the service", e);
    }
    return "";
}
 
Example 17
Project: Jouve-Project   File: SkosServicesImpl.java   Source Code and License 6 votes vote down vote up
@SuppressWarnings("unchecked")
private static void processChildren(Element element, List<String> collectedNamespaces,
    SimpleNamespaceContext namespaceContext) {
    Namespace currentNamespace = (Namespace) element.getNamespace();
    String nsUri = (currentNamespace.getURI());
    if (!exist(collectedNamespaces, nsUri)) {
        collectedNamespaces.add(nsUri.trim());
        namespaceContext.addNamespace(currentNamespace.getPrefix(), currentNamespace.getURI());
    }
    List<Namespace> additionalNs = element.getAdditionalNamespaces();
    if (!additionalNs.isEmpty())
        copyNsList(additionalNs, collectedNamespaces, namespaceContext);
    if (element.getChildren().size() > 0) {
        List<Element> elementChildren = element.getChildren();
        for (int i = 0; i < elementChildren.size(); i++) {
            processChildren(elementChildren.get(i), collectedNamespaces, namespaceContext);
        }
    }
}
 
Example 18
Project: joai-project   File: InfoXML.java   Source Code and License 5 votes vote down vote up
/**
 * Constructs the infoXML abstraction based on the input
 * given.
 * 
 * @param _xml
 */
public InfoXML ( String _xml )
{
	try {
		// TODO : BARFS on the xsi: attribute on return saying :
		//			org.dom4j.DocumentException: Error on line 1 of document  : 
		//			The prefix "xsi" for attribute "xsi:schemaLocation" associated with 
		//			an element type "NSDLDataRepository" is not bound. 
		//			Nested exception: The prefix "xsi" for attribute "xsi:schemaLocation" 
		//			associated with an element type "NSDLDataRepository" is not bound.

		this.contentRaw = _xml;
		this.infoxmlDoc = DocumentHelper.parseText( this.contentRaw );
					
		XPath xpath = DocumentHelper.createXPath( "//ndr:error" ); // for error node checks

		// TODO : though the default namespace is NOT called NDR,
		// http://www.xslt.com/html/xsl-list/2005-03/msg01059.html indicates we must give
		// it one if we are to use it in an XPath.  How fun is that!
		SimpleNamespaceContext ns = new SimpleNamespaceContext();
		ns.addNamespace("ndr", "http://ns.nsdl.org/ndr/response_v1.00/");
		
		xpath.setNamespaceContext(ns);
		
		// select the error node
    	Element error = (Element)xpath.selectSingleNode(this.infoxmlDoc);
    	
    	if ( error != null )
    	{
    		this.hasErrors = true;
    		this.errorString = error.getText();
    	}
    	
	} catch ( Exception e ) {
		this.contentRaw = _xml;
		this.errorString = "Fatal error in InfoXML construction.";
		// e.printStackTrace();
	}		
}
 
Example 19
Project: joai-project   File: NamespaceRegistry.java   Source Code and License 5 votes vote down vote up
/**
 *  Gets the namespaceContext attribute of the NamespaceRegistry object
 *
 * @return    The namespaceContext value
 */
public SimpleNamespaceContext getNamespaceContext() {
	SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
	for (Iterator i = this.getNamespaces().iterator(); i.hasNext(); ) {
		Namespace ns = (Namespace) i.next();
		nsContext.addNamespace(ns.getPrefix(), ns.getURI());
	}
	return nsContext;
}
 
Example 20
Project: scribe   File: SOAPExecutor.java   Source Code and License 5 votes vote down vote up
/**
 * Namespace context resolver
 * 
 * @param context namespace context
 * @param element SOAP message element
 */
public static final void addNamespaces(final SimpleNamespaceContext context, final SOAPElement element) {
  final Iterator<?> namespaces = element.getNamespacePrefixes();
  while (namespaces.hasNext()) {
    final String prefix = (String) namespaces.next();
    final String uri = element.getNamespaceURI(prefix);
    context.addNamespace(prefix, uri);
  }
}
 
Example 21
Project: core   File: DynamicXsltProcessor.java   Source Code and License 5 votes vote down vote up
private static XPath buildXpath(Element xslt, final String functionCall) {
    XPath xpath = xslt.createXPath(String.format(
            "//xsl:value-of[@select='%s']", functionCall));
    SimpleNamespaceContext namespaceContext = new SimpleNamespaceContext();
    namespaceContext.addNamespace("xsl",
            "http://www.w3.org/1999/XSL/Transform");
    xpath.setNamespaceContext(namespaceContext);
    return xpath;
}
 
Example 22
Project: dls-repository-stack   File: GetMultipleRequest.java   Source Code and License 5 votes vote down vote up
private List getObjectList1 (Element resultData) {
	// pp (resultData);
	Document doc = DocumentHelper.createDocument(resultData.createCopy());
	NameSpaceXMLDocReader reader = null;
	List objects = new ArrayList();
	try {
		reader = new NameSpaceXMLDocReader (doc);
	} catch (Exception e) {
		prtln ("could not parse resultData: " + e.getMessage());
		return objects;
	}
	
	/* have to add "ndr" namespace (in the document it is default and therefore
	not known by prefix)
	*/
	SimpleNamespaceContext nsContext = reader.getNamespaceContext();
	// nsContext.addNamespace ("ndr", "http://ns.nsdl.org/ndr/response_v1.00/");
	
	String path = "/ndr:resultData/ndr:objectList/ndr:object/ndr:NDRObject";
	
	List nodes = reader.getNodes (path);
	prtln (nodes.size() + " objects found");
	for (Iterator i=nodes.iterator();i.hasNext();)
		objects.add ( ((Element)i.next()).createCopy());
	
	return objects;
}
 
Example 23
Project: dls-repository-stack   File: InfoXML.java   Source Code and License 5 votes vote down vote up
/**
 * Constructs the infoXML abstraction based on the input
 * given.
 * 
 * @param _xml
 */
public InfoXML ( String _xml )
{
	try {
		// TODO : BARFS on the xsi: attribute on return saying :
		//			org.dom4j.DocumentException: Error on line 1 of document  : 
		//			The prefix "xsi" for attribute "xsi:schemaLocation" associated with 
		//			an element type "NSDLDataRepository" is not bound. 
		//			Nested exception: The prefix "xsi" for attribute "xsi:schemaLocation" 
		//			associated with an element type "NSDLDataRepository" is not bound.

		this.contentRaw = _xml;
		this.infoxmlDoc = DocumentHelper.parseText( this.contentRaw );
					
		XPath xpath = DocumentHelper.createXPath( "//ndr:error" ); // for error node checks

		// TODO : though the default namespace is NOT called NDR,
		// http://www.xslt.com/html/xsl-list/2005-03/msg01059.html indicates we must give
		// it one if we are to use it in an XPath.  How fun is that!
		SimpleNamespaceContext ns = new SimpleNamespaceContext();
		ns.addNamespace("ndr", "http://ns.nsdl.org/ndr/response_v1.00/");
		
		xpath.setNamespaceContext(ns);
		
		// select the error node
    	Element error = (Element)xpath.selectSingleNode(this.infoxmlDoc);
    	
    	if ( error != null )
    	{
    		this.hasErrors = true;
    		this.errorString = error.getText();
    	}
    	
	} catch ( Exception e ) {
		this.contentRaw = _xml;
		this.errorString = "Fatal error in InfoXML construction.";
		// e.printStackTrace();
	}		
}
 
Example 24
Project: dls-repository-stack   File: NamespaceRegistry.java   Source Code and License 5 votes vote down vote up
/**
 *  Gets the namespaceContext attribute of the NamespaceRegistry object
 *
 * @return    The namespaceContext value
 */
public SimpleNamespaceContext getNamespaceContext() {
	SimpleNamespaceContext nsContext = new SimpleNamespaceContext();
	for (Iterator i = this.getNamespaces().iterator(); i.hasNext(); ) {
		Namespace ns = (Namespace) i.next();
		nsContext.addNamespace(ns.getPrefix(), ns.getURI());
	}
	return nsContext;
}
 
Example 25
Project: ec2-plugin   File: WinRMClient.java   Source Code and License 5 votes vote down vote up
public boolean slurpOutput(PipedOutputStream stdout, PipedOutputStream stderr) throws IOException {
    log.log(Level.FINE, "--> SlurpOutput");
    ImmutableMap<String, PipedOutputStream> streams = ImmutableMap.of("stdout", stdout, "stderr", stderr);

    Document request = factory.newGetOutputRequest(shellId, commandId).build();
    Document response = sendRequest(request);

    XPath xpath = DocumentHelper.createXPath("//" + Namespaces.NS_WIN_SHELL.getPrefix() + ":Stream");
    namespaceContext = new SimpleNamespaceContext();
    namespaceContext.addNamespace(Namespaces.NS_WIN_SHELL.getPrefix(), Namespaces.NS_WIN_SHELL.getURI());
    xpath.setNamespaceContext(namespaceContext);

    Base64 base64 = new Base64();
    for (Element e : (List<Element>) xpath.selectNodes(response)) {
        PipedOutputStream stream = streams.get(e.attribute("Name").getText().toLowerCase());
        final byte[] decode = base64.decode(e.getText());
        log.log(Level.FINE, "piping " + decode.length + " bytes from " + e.attribute("Name").getText().toLowerCase());

        stream.write(decode);
    }

    XPath done = DocumentHelper
            .createXPath("//*[@State='http://schemas.microsoft.com/wbem/wsman/1/windows/shell/CommandState/Done']");
    done.setNamespaceContext(namespaceContext);
    if (Iterables.isEmpty(done.selectNodes(response))) {
        log.log(Level.FINE, "keep going baby!");
        return true;
    } else {
        exitCode = Integer.parseInt(first(response, "//" + Namespaces.NS_WIN_SHELL.getPrefix() + ":ExitCode"));
        log.log(Level.FINE, "no more output - command is now done - exit code: " + exitCode);
    }
    return false;
}
 
Example 26
Project: ec2-plugin   File: WinRMMessageTest.java   Source Code and License 5 votes vote down vote up
@Before
public void before() throws Exception
{
    url = new URL("http://localhost");
    namespaceContext = new SimpleNamespaceContext();
    namespaceContext.addNamespace(Namespaces.NS_WIN_SHELL.getPrefix(), Namespaces.NS_WIN_SHELL.getURI());
    namespaceContext.addNamespace(Namespaces.NS_ADDRESSING.getPrefix(), Namespaces.NS_ADDRESSING.getURI());
    namespaceContext.addNamespace(Namespaces.NS_WSMAN_DMTF.getPrefix(), Namespaces.NS_WSMAN_DMTF.getURI());
    namespaceContext.addNamespace(Namespaces.NS_WSMAN_MSFT.getPrefix(), Namespaces.NS_WSMAN_MSFT.getURI());
    namespaceContext.addNamespace(Namespaces.NS_SOAP_ENV.getPrefix(), Namespaces.NS_SOAP_ENV.getURI());
}
 
Example 27
Project: jaxen   File: SimpleNamespaceContextTest.java   Source Code and License 5 votes vote down vote up
/**
 * Need to make sure that changing the map after it's used to create the 
 * namespace context does not affect the context. i.e.
 * data encapsulation is not violated.
 */
public void testMapCopy() {
    Map map = new HashMap();
    SimpleNamespaceContext context = new SimpleNamespaceContext(map);
    map.put("pre", "http://www.example.org/");
    assertNull(context.translateNamespacePrefixToUri("pre"));
}
 
Example 28
Project: jaxen   File: SimpleNamespaceContextTest.java   Source Code and License 5 votes vote down vote up
public void testCantUseNonStringsAsValues() {
    Map map = new HashMap();
    map.put("key", new Object());
    try {
        new SimpleNamespaceContext(map);
        fail("added non String value to namespace context");
    }
    catch (Exception ex) {
        assertNotNull(ex.getMessage());
    }
}
 
Example 29
Project: jaxen   File: SimpleNamespaceContextTest.java   Source Code and License 5 votes vote down vote up
public void testCantUseNonStringsAsKeys() {
    Map map = new HashMap();
    map.put(new Object(), "value");
    try {
        new SimpleNamespaceContext(map);
        fail("added non String key to namespace context");
    }
    catch (Exception ex) {
        assertNotNull(ex.getMessage());
    }
}
 
Example 30
Project: jaxen   File: SimpleNamespaceContextTest.java   Source Code and License 5 votes vote down vote up
public void testContextFromElement() throws ParserConfigurationException, UnsupportedAxisException { 
    SimpleNamespaceContext context = new SimpleNamespaceContext();
    DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
    factory.setNamespaceAware(true);
    DocumentBuilder builder = factory.newDocumentBuilder();
    Document doc = builder.newDocument();
    Element root = doc.createElementNS("http://www.example.org/", "pre:root");
    doc.appendChild(root);
    context.addElementNamespaces(new org.jaxen.dom.DocumentNavigator(), root);
    
    assertEquals("http://www.example.org/", context.translateNamespacePrefixToUri("pre"));
}
 
Example 31
Project: jaxen   File: NamespaceTest.java   Source Code and License 5 votes vote down vote up
public void testQueryDefaultNamespaceWithContext() throws JaxenException {
    
    Element root = doc.createElementNS("http://www.example.org/", "root");
    doc.appendChild(root);
    XPath xpath = new DOMXPath("/pre:root");
    SimpleNamespaceContext context = new SimpleNamespaceContext();
    context.addNamespace("pre", "http://www.example.org/");
    xpath.setNamespaceContext(context);
    List result = xpath.selectNodes(root);
    assertEquals(1, result.size());
   
}
 
Example 32
Project: community-edition-old   File: GetWebCollectionEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Returns the titles and URLs of all sites directly beneath the current site
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");

    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // get site name that is used to list subsites
    String siteName = getDwsFromUri(soapRequest);
    DocsMetaInfo docsMetaInfo = null;

    if (siteName.equals(""))
    {
        docsMetaInfo = handler.getListDocuments(siteName, false, false, "", "", false, false, true, true, false, false, false, false, new HashMap<String, Object>(0), false);
    }

    // creating soap response
    Element responseElement = soapResponse.getDocument().addElement("GetWebCollectionResponse", namespace);
    Element result = responseElement.addElement("GetWebCollectionResult");       
    Element webs = result.addElement("Webs");

    if (docsMetaInfo != null)
    {
        for (DocMetaInfo docMetaInfo : docsMetaInfo.getFolderMetaInfoList())
        {
            Element web = webs.addElement("Web");
            web.addAttribute("Title", docMetaInfo.getPath());
            web.addAttribute("Url", getHost(soapRequest) + soapRequest.getAlfrescoContextName() + "/" + docMetaInfo.getPath());
        }
    }

    if (logger.isDebugEnabled())
    {
        logger.debug("Soap Method with name " + getName() + " is finished.");
    }
}
 
Example 33
Project: community-edition-old   File: CreateFolderEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Creates new folder in site's document library
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting url parameter from request
    XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/CreateFolder/url"));
    urlPath.setNamespaceContext(nc);
    Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
    
    handler.createFolder(getDwsFromUri(soapRequest) + "/" + url.getText());
    
    // creating soap response
    Element root = soapResponse.getDocument().addElement("CreateFolderResponse", namespace);
    Element createFolderResult = root.addElement("CreateFolderResult");

    // Contents are standalone XML
    createFolderResult.setText("<Result/>");
    
    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
    
}
 
Example 34
Project: community-edition-old   File: RenameDwsEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Rename document workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting title parameter from request
    XPath titlePath = new Dom4jXPath(buildXPath(prefix, "/RenameDws/title"));
    titlePath.setNamespaceContext(nc);
    Element title = (Element) titlePath.selectSingleNode(soapRequest.getDocument().getRootElement());
    
    handler.renameDws(getDwsFromUri(soapRequest), title.getText());
    
    // creating soap response
    Element root = soapResponse.getDocument().addElement("RenameDwsResponse");
    Element renameDwsResult = root.addElement("RenameDwsResult", namespace);

    renameDwsResult.setText("<Result/>");
    
    if (logger.isDebugEnabled()) 
    {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
    
}
 
Example 35
Project: community-edition-old   File: AbstractListEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Deletes document workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception   {
   if (logger.isDebugEnabled()) {
      logger.debug("SOAP method with name " + getName() + " is started.");
   }

   // mapping xml namespace to prefix
   SimpleNamespaceContext nc = new SimpleNamespaceContext();
   nc.addNamespace(soapUriPrefix, soapUri);
   nc.addNamespace(prefix, namespace);

   // Grab the site name
   String dws = getDwsFromUri(soapRequest);        

   // Fetch the root of the document
   Element requestElement = soapRequest.getDocument().getRootElement();

   // Get the listName parameter from the request
   XPath listNameXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/listName"));
   listNameXPath.setNamespaceContext(nc);
   Element listNameE = (Element) listNameXPath.selectSingleNode(requestElement);
   String listName = null;
   if (listNameE != null)
   {
      listName = listNameE.getTextTrim();
   }
   
   // Have any further details fetched as needed
   executeListActionDetails(soapRequest, soapResponse, dws, listName, requestElement, nc);
   
   // All done
   if (logger.isDebugEnabled()) {
      logger.debug("SOAP method with name " + getName() + " is finished.");
   }        
}
 
Example 36
Project: community-edition-old   File: AbstractListEndpoint.java   Source Code and License 5 votes vote down vote up
protected void executeListActionDetails(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
     String siteName, String listName, Element requestElement, SimpleNamespaceContext nc) throws Exception
{
   // Get the description parameter from the request
   XPath descriptionXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/description"));
   descriptionXPath.setNamespaceContext(nc);
   Element descriptionE = (Element) descriptionXPath.selectSingleNode(soapRequest.getDocument().getRootElement());
   String description = null;
   if (descriptionE != null)
   {
      description = descriptionE.getTextTrim();
   }
   
   // Get the template ID parameter from the request
   XPath templateXPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/templateID"));
   templateXPath.setNamespaceContext(nc);
   Element templateE = (Element) templateXPath.selectSingleNode(soapRequest.getDocument().getRootElement());
   int templateID = -1;
   if (templateE != null)
   {
      templateID = Integer.parseInt( templateE.getTextTrim() );
   }


   // Have the List Added / Fetched
   ListInfoBean list = executeListAction(soapRequest, siteName, listName, description, templateID);
   
   // Have it rendered
   renderList(soapRequest, soapResponse, siteName, list);
}
 
Example 37
Project: community-edition-old   File: WebUrlFromPageUrlEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Retrieves url of the document workspace site from the document url
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");
    
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting pageUrl parameter from request
    XPath xpath = new Dom4jXPath(buildXPath(prefix, "/WebUrlFromPageUrl/pageUrl"));
    xpath.setNamespaceContext(nc);
    String pageUrl = URLDecoder.decode(((Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement())).getTextTrim(), "UTF-8");        

    if (logger.isDebugEnabled())
        logger.debug("pageUrl parameter for this request: " + pageUrl);
    String server = getHost(soapRequest);
    String context = soapRequest.getAlfrescoContextName();
            
    String[] uris = handler.decomposeURL(URIUtil.getPath(pageUrl), context);

    // creating soap response
    Element responseElement = soapResponse.getDocument().addElement("WebUrlFromPageUrlResponse", namespace);
    Element result = responseElement.addElement("WebUrlFromPageUrlResult");       
    result.setText(server + uris[0]);
    
    if (logger.isDebugEnabled())
    {
        logger.debug("Soap Method with name " + getName() + " is finished.");
    }
}
 
Example 38
Project: community-edition-old   File: CanCreateDwsUrlEndpoint.java   Source Code and License 5 votes vote down vote up
/**
* Creates new document workspace with given title
* 
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting title parameter from request
    XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/CanCreateDwsUrl/url"));
    urlPath.setNamespaceContext(nc);
    Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
    
    String urlText = "";
    if(url != null)
    {
        urlText = url.getTextTrim();
        if (urlText.equals(""))
        {
            // [MS-DWSS] return a generated/unique name
            urlText = GUID.generate();
        }
    }
    if (false == handler.canCreateDwsUrl(urlText))
    {
       throw new VtiHandlerException(VtiError.NO_PERMISSIONS);
    }
    
    // creating soap response
    Element resultElement = buildResultTag(soapResponse);
    resultElement.setText(processTag("Result", urlText).toString());

    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}        
}
 
Example 39
Project: community-edition-old   File: RemoveDwsUserEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Removes user from site
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}    	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting id parameter from request
    XPath idPath = new Dom4jXPath(buildXPath(prefix, "/RemoveDwsUser/id"));
    idPath.setNamespaceContext(nc);
    Element id = (Element) idPath.selectSingleNode(soapRequest.getDocument().getRootElement());
    
    handler.removeDwsUser(getDwsFromUri(soapRequest), id.getText());
    
    // creating soap response
    Element root = soapResponse.getDocument().addElement("RemoveDwsUserResponse", namespace);
    Element removeDwsUserResult = root.addElement("RemoveDwsUserResult");

    removeDwsUserResult.setText("<Results/>");
    
    if (logger.isDebugEnabled()) 
    {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
    
}
 
Example 40
Project: community-edition-old   File: AbstractMeetingEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Add/Update/Delete meeting in Meeting Workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse})
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);
    
    // Get the site
    String siteName = getDwsFromUri(soapRequest);
    if (siteName == null || siteName.length() == 0)
    {
        throw new VtiSoapException("A Site Name must be supplied", 6);
    }
    else
    {
        if (siteName.startsWith("/"))
        {
            siteName = siteName.substring(1);
        }
    }
    
    
    // Process the request
    Element requestElement = soapRequest.getDocument().getRootElement();
    executeRequest(soapRequest, soapResponse, siteName, requestElement, nc);
}
 
Example 41
Project: community-edition-old   File: AbstractWorkspaceEndpoint.java   Source Code and License 5 votes vote down vote up
protected TimeZoneInformation getTimeZoneInformation(Element requestElement) throws Exception
{
    TimeZoneInformation timeZoneInforation = new TimeZoneInformation();

    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);
    
    // Is the timezone present?
    XPath timezonePath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation"));
    timezonePath.setNamespaceContext(nc);
    Element tzElement = (Element)timezonePath.selectSingleNode(requestElement);
    if (tzElement == null)
    {
        if (logger.isDebugEnabled())
            logger.debug("No TimeZone information supplied, using the default");
        return null;
    }

    // Fetch the details of the timezone
    // TODO Fetch from the tzElement object
    XPath biasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/bias"));
    biasPath.setNamespaceContext(nc);
    timeZoneInforation.setBias(Integer.valueOf(((Element) biasPath.selectSingleNode(requestElement)).getTextTrim()));

    timeZoneInforation.setStandardDate(createTimeZoneInformationDate(requestElement, "standardDate"));

    XPath standardBiasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/standardBias"));
    standardBiasPath.setNamespaceContext(nc);
    timeZoneInforation.setStandardBias(Integer.valueOf(((Element) standardBiasPath.selectSingleNode(requestElement)).getTextTrim()));

    timeZoneInforation.setDaylightDate(createTimeZoneInformationDate(requestElement, "daylightDate"));

    XPath daylightBiasPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/daylightBias"));
    daylightBiasPath.setNamespaceContext(nc);
    timeZoneInforation.setDaylightBias(Integer.valueOf(((Element) daylightBiasPath.selectSingleNode(requestElement)).getTextTrim()));

    return timeZoneInforation;
}
 
Example 42
Project: community-edition-old   File: DeleteFolderEndpoint.java   Source Code and License 5 votes vote down vote up
/**
 * Delete folder from site's document library
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception   
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting url parameter from request
    XPath urlPath = new Dom4jXPath(buildXPath(prefix, "/DeleteFolder/url"));
    urlPath.setNamespaceContext(nc);
    Element url = (Element) urlPath.selectSingleNode(soapRequest.getDocument().getRootElement());
    
    handler.deleteFolder(getDwsFromUri(soapRequest) + "/" + url.getText());
   
    // creating soap response
    Element root = soapResponse.getDocument().addElement("DeleteFolderResponse", namespace);
    Element deleteFolderResult = root.addElement("DeleteFolderResult");

    deleteFolderResult.addElement("Result");
    
    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
    
}
 
Example 43
Project: community-edition-old   File: CreateDwsEndpoint.java   Source Code and License 5 votes vote down vote up
/**
* Creates new document workspace with given title
* 
* @param soapRequest Vti soap request ({@link VtiSoapRequest})
* @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
*/
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    Element rootElement = soapRequest.getDocument().getRootElement();

    // getting title parameter from request
    String dwsName = getParameter(rootElement, "/CreateDws/name", nc);
    
    // getting title parameter from request
    String title = getParameter(rootElement, "/CreateDws/title", nc);
    
    String parentDws = getDwsForCreationFromUri(soapRequest);
    DwsBean dws = handler.createDws(parentDws, dwsName, null, title, null, getHost(soapRequest), getContext(soapRequest), (SessionUser) soapRequest.getSession().getAttribute(SharepointConstants.USER_SESSION_ATTRIBUTE));
    
    // creating soap response
    Element resultElement = buildResultTag(soapResponse);
    
    resultElement.addText(generateXml(dws));
    
    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}        
}
 
Example 44
Project: community-edition-old   File: CreateDwsEndpoint.java   Source Code and License 5 votes vote down vote up
protected String getParameter(Element rootElement, String path, SimpleNamespaceContext nc) throws JaxenException
{
    XPath xPath = new Dom4jXPath(buildXPath(prefix, path));
    xPath.setNamespaceContext(nc);
    Element titleEl = (Element) xPath.selectSingleNode(rootElement);
    return titleEl.getTextTrim();
}
 
Example 45
Project: community-edition-old   File: TestAbstractListItemsEndpointTest.java   Source Code and License 5 votes vote down vote up
@Test
public void correctErrorCodeReturnedWhenSiteNotFound() throws Exception
{
    VtiSoapRequest soapRequest = Mockito.mock(VtiSoapRequest.class);
    VtiSoapResponse soapResponse = new VtiSoapResponse(new MockHttpServletResponse());//Mockito.mock(VtiSoapResponse.class);
    Element requestElement = Mockito.mock(Element.class);
    SimpleNamespaceContext nc = Mockito.mock(SimpleNamespaceContext.class);
    
    when(nc.translateNamespacePrefixToUri(anyString())).thenReturn("some://uri");
    
    Element rootElement = new DefaultElement("root");
    when(soapRequest.getDocument()).thenReturn(new DefaultDocument(rootElement));
    
    // ALF-19833: listName was being passed to getList for both arguments.
    when(listHandler.getList("documentLibrary", "my-site")).thenThrow(new SiteDoesNotExistException(""));
    
    // Invoke the method under test.
    try
    {
        listItemsEndpoint.executeListActionDetails(soapRequest, soapResponse,
                    "my-site", "documentLibrary", requestElement, nc);
        
        fail("Expected exception was not thrown.");
    }
    catch(VtiSoapException e)
    {
        assertEquals(VtiError.V_LIST_NOT_FOUND.getErrorCode(), e.getErrorCode());
    }
}
 
Example 46
Project: Text2Process   File: FrameNet.java   Source Code and License 5 votes vote down vote up
private void init(Logger logger) {
	this.logger = logger;

	flush();

	
	//create a namespace mapping for the default namespace
	HashMap<String, String> namespaceMapping = new HashMap<String, String>();
	namespaceMapping.put("berk", "http://framenet.icsi.berkeley.edu");
	simpleNSC = new SimpleNamespaceContext(namespaceMapping);
	// this.dbInterface = new FrameNetDatabaseInterface(fnhome, false,
	// this.getLogger(), new HashSet<String>());

}
 
Example 47
Project: pdi-agile-bi-plugin   File: AnalyzerVisualization.java   Source Code and License 5 votes vote down vote up
public static String getDocumentText( Document doc, String xPath ) throws JaxenException {
   Dom4jXPath xpath = new Dom4jXPath( xPath );
   HashMap<String, String> map = new HashMap<String, String>();
   map.put( "pho", "http://www.pentaho.com");  //$NON-NLS-1$//$NON-NLS-2$
   xpath.setNamespaceContext( new SimpleNamespaceContext( map));
   org.dom4j.Node node = (org.dom4j.Node) xpath.selectSingleNode( doc);
   return node.getText();
}
 
Example 48
Project: pdi-agile-bi-plugin   File: AnalyzerVisualization.java   Source Code and License 5 votes vote down vote up
public static void setDocumentText( Document doc, String xPath, String value ) throws JaxenException {
  Dom4jXPath xpath = new Dom4jXPath( xPath );
  HashMap<String, String> map = new HashMap<String, String>();
  map.put( "pho", "http://www.pentaho.com");  //$NON-NLS-1$//$NON-NLS-2$
  xpath.setNamespaceContext( new SimpleNamespaceContext( map));
  org.dom4j.Node node = (org.dom4j.Node) xpath.selectSingleNode( doc);
  node.setText( value );
}
 
Example 49
Project: Jouve-Project   File: SkosServicesImpl.java   Source Code and License 5 votes vote down vote up
private static void copyNsList(List<Namespace> additionalNs, List<String> collectedNamespaces,
    SimpleNamespaceContext namespaceContext) {
    for (int i = 0; i < additionalNs.size(); i++) {
        Namespace ns = additionalNs.get(i);
        namespaceContext.addNamespace(ns.getPrefix(), ns.getURI());
        collectedNamespaces.add(ns.getURI().trim());
    }
}
 
Example 50
Project: dls-repository-stack   File: NameSpaceXMLDocReader.java   Source Code and License 4 votes vote down vote up
public SimpleNamespaceContext getNamespaceContext () {
	return this.nsContext;
}
 
Example 51
Project: community-edition-old   File: GetListCollectionEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Returns the names and GUIDs for all the lists in the site
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");

    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // get site name that is used to list subsites
    String siteName = getDwsFromUri(soapRequest);
    
    List<ListInfoBean> lists;
    
    if (siteName.equals(""))
    {
        lists = new ArrayList<ListInfoBean>(0); 
    }
    else
    {
        try
        {
            lists = handler.getListCollection(siteName);
        }
        catch (SiteDoesNotExistException e)
        {
            throw new VtiHandlerException(VtiHandlerException.BAD_URL);
        }
    }

    // creating soap response
    Element responseElement = soapResponse.getDocument().addElement("GetListCollectionResponse", namespace);
    Element resultElement = responseElement.addElement("GetListCollectionResult");       
    Element listsElement = resultElement.addElement("Lists");
    
    for (ListInfoBean list : lists)
    {
        String siteUrl = getContext(soapRequest) + "/" + siteName;
        
        Element listElement = listsElement.addElement("List");
        renderListDefinition(list, siteName, siteUrl, listElement);
    }

    if (logger.isDebugEnabled())
    {
        logger.debug("Soap Method with name " + getName() + " is finished.");
    }
}
 
Example 52
Project: community-edition-old   File: GetDwsMetaDataEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Retrieves information about document workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);
    
    Element reqElement = soapRequest.getDocument().getRootElement();
    
    // getting document parameter from request
    XPath docPath = new Dom4jXPath(buildXPath(prefix, "/GetDwsMetaData/document"));
    docPath.setNamespaceContext(nc);
    String doc = ((Element) docPath.selectSingleNode(reqElement)).getText();

    // getting id parameter from request
    XPath idPath = new Dom4jXPath(buildXPath(prefix, "/GetDwsMetaData/id"));
    idPath.setNamespaceContext(nc);
    Element id = (Element) idPath.selectSingleNode(reqElement);

    // getting minimal parameter from request
    XPath minimalPath = new Dom4jXPath(buildXPath(prefix, "/GetDwsMetaData/minimal"));
    minimalPath.setNamespaceContext(nc);
    Element minimal = (Element) minimalPath.selectSingleNode(reqElement);
    
    //getting information about document workspace
     DwsMetadata dwsMetadata = handler.getDWSMetaData(URLDecoder.decode(doc, "UTF-8"), id.getText(), Boolean.valueOf(minimal.getText()));
    
    // creating soap response
    Element root = soapResponse.getDocument().addElement("GetDwsMetaDataResponse", namespace);
    Element getDwsMetaDataResult = root.addElement("GetDwsMetaDataResult");

    getDwsMetaDataResult.addText(generateXml(dwsMetadata));
    
    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
}
 
Example 53
Project: community-edition-old   File: UndoCheckOutFileEndpoint.java   Source Code and License 4 votes vote down vote up
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");

    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    String host = getHost(soapRequest);
    String context = soapRequest.getAlfrescoContextName();

    // getting pageUrl parameter from request
    XPath xpath = new Dom4jXPath(buildXPath(prefix, "/UndoCheckOut/pageUrl"));
    xpath.setNamespaceContext(nc);
    Element docE = (Element) xpath.selectSingleNode(soapRequest.getDocument().getRootElement());
    if (docE == null || docE.getTextTrim().length() == 0)
    {
       throw new VtiSoapException("pageUrl must be supplied", 0x82000001l);
    }
    
    String docPath = URLDecoder.decode(docE.getTextTrim(), "UTF-8");
    if(docPath.indexOf(host) == -1 || docPath.indexOf(context) == -1)
    {
       throw new VtiSoapException("Invalid URI: The format of the URI could not be determined", 0x80070002l);
    }
    docPath = docPath.substring(host.length() + context.length());

    if (logger.isDebugEnabled())
    {
        logger.debug("item parameter for this request: " + docPath);
    }

    boolean lockAfterSucess = false;
    String officeVersion = soapRequest.getHeader(HEADER_X_OFFICE_VERSION);

    // Lock original node if we work with Office 2010 and greater
    if (officeVersion != null && Integer.parseInt(officeVersion.split("\\.")[0]) >= 14)
    {
        lockAfterSucess = true;
    }

    NodeRef originalNode = handler.undoCheckOutDocument(docPath, lockAfterSucess);

    // creating soap response
    Element responseElement = soapResponse.getDocument().addElement("UndoCheckOutResponse", namespace);
    Element result = responseElement.addElement("UndoCheckOutResult");
    result.setText(originalNode != null ? "true" : "false");

    soapResponse.setContentType("text/xml");
    if (logger.isDebugEnabled())
    {
        logger.debug("Soap Method with name " + getName() + " is finished.");
    }

}
 
Example 54
Project: community-edition-old   File: AddUserCollectionToRoleEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Adds new user to the site with given role
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */

@SuppressWarnings("unchecked")
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);
    
    Element requestElement = soapRequest.getDocument().getRootElement();

    // getting document parameter from request
    if (logger.isDebugEnabled()) 
        logger.debug("Getting role from request.");
    XPath roleNamePath = new Dom4jXPath(buildXPath(prefix, "/AddUserCollectionToRole/roleName"));
    roleNamePath.setNamespaceContext(nc);
    Element roleName = (Element) roleNamePath.selectSingleNode(requestElement);
    
    // getting document parameter from request
    if (logger.isDebugEnabled()) 
        logger.debug("Getting users from request.");        
    XPath usersPath = new Dom4jXPath(buildXPath(prefix, "/AddUserCollectionToRole/usersInfoXml/Users/User"));
    usersPath.setNamespaceContext(nc);
    List<Element> usersElementList = (List<Element>) usersPath.selectNodes(requestElement);

    List<UserBean> usersList = new ArrayList<UserBean>();
    for (Element userElement : usersElementList)
    {
        usersList.add(new UserBean(userElement.attributeValue("Name"), userElement.attributeValue("LoginName"), userElement.attributeValue("Email"), userElement.attributeValue("Notes")));
    }
    
    String role = roleName.getTextTrim();
    if (role != null)
    {
        String dws = getDwsFromUri(soapRequest);
        if (logger.isDebugEnabled()) { 
            String users = "";
            for (UserBean userBean : usersList) {
                users += userBean.getDisplayName() + ", ";
            }
            logger.debug("Adding users [ " + users + "] with role '" + role + "' to the site '" + dws + "'");
        }            
        handler.addUserCollectionToRole(dws, role, usersList);
        // creating soap response
        soapResponse.getDocument().addElement("AddUserCollectionToRoleResponse", namespace);            
    }

    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is finished.");  
    
}
 
Example 55
Project: community-edition-old   File: GetDwsDataEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Retrieves information about document workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse}) 
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
	if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is started.");
	}
	
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    // getting document parameter from request
    XPath docPath = new Dom4jXPath(buildXPath(prefix, "/GetDwsData/document"));
    docPath.setNamespaceContext(nc);
    String doc = ((Element) docPath.selectSingleNode(soapRequest.getDocument().getRootElement())).getText();

    // getting lastUpdate parameter from request
    XPath lastUpdatePath = new Dom4jXPath(buildXPath(prefix, "/GetDwsData/lastUpdate"));
    lastUpdatePath.setNamespaceContext(nc);
    Element lastUpdate = (Element) lastUpdatePath.selectSingleNode(soapRequest.getDocument().getRootElement());                
   
    DwsData dwsData;
    try
    {
       dwsData = handler.getDwsData(URLDecoder.decode(doc, "UTF-8"), lastUpdate.getTextTrim());
    }
    catch(SiteDoesNotExistException e)
    {
       throw new VtiHandlerException(VtiError.V_URL_NOT_FOUND);
    }
    
    // creating soap response
    Element root = soapResponse.getDocument().addElement("GetDwsDataResponse", namespace);
    Element getDwsDataResult = root.addElement("GetDwsDataResult");

    getDwsDataResult.setText(generateXml(dwsData));
    
    if (logger.isDebugEnabled()) {
		logger.debug("SOAP method with name " + getName() + " is finished.");
	}
}
 
Example 56
Project: community-edition-old   File: AbstractWorkspaceEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Performs the appropriate action on the workspace
 */
protected abstract void executeWorkspaceAction(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse,
        Element requestElement, SimpleNamespaceContext nc,
        String siteName, String title, String templateName, int lcid) throws Exception;
 
Example 57
Project: community-edition-old   File: AbstractWorkspaceEndpoint.java   Source Code and License 4 votes vote down vote up
private TimeZoneInformationDate createTimeZoneInformationDate(Element element, String typeOfDate) throws Exception
{
    TimeZoneInformationDate date = new TimeZoneInformationDate();

    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    XPath dateYearPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/year"));
    dateYearPath.setNamespaceContext(nc);
    date.setYear(Integer.valueOf(((Element) dateYearPath.selectSingleNode(element)).getTextTrim()));

    XPath dateMonthPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/month"));
    dateMonthPath.setNamespaceContext(nc);
    date.setMonth(Integer.valueOf(((Element) dateMonthPath.selectSingleNode(element)).getTextTrim()));

    XPath dateDayOfWeekPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/dayOfWeek"));
    dateDayOfWeekPath.setNamespaceContext(nc);
    date.setDayOfWeek(Integer.valueOf(((Element) dateDayOfWeekPath.selectSingleNode(element)).getTextTrim()));

    XPath dateDayPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/day"));
    dateDayPath.setNamespaceContext(nc);
    date.setDay(Integer.valueOf(((Element) dateDayPath.selectSingleNode(element)).getTextTrim()));

    XPath dateHourPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/hour"));
    dateHourPath.setNamespaceContext(nc);
    date.setHour(Integer.valueOf(((Element) dateHourPath.selectSingleNode(element)).getTextTrim()));

    XPath dateMinutePath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/minute"));
    dateMinutePath.setNamespaceContext(nc);
    date.setMinute(Integer.valueOf(((Element) dateMinutePath.selectSingleNode(element)).getTextTrim()));

    XPath dateSecondPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/second"));
    dateSecondPath.setNamespaceContext(nc);
    date.setSecond(Integer.valueOf(((Element) dateSecondPath.selectSingleNode(element)).getTextTrim()));

    XPath dateMillisecondsPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/timeZoneInformation/" + typeOfDate + "/milliseconds"));
    dateMillisecondsPath.setNamespaceContext(nc);
    date.setMilliseconds(Integer.valueOf(((Element) dateMillisecondsPath.selectSingleNode(element)).getTextTrim()));

    return date;
}
 
Example 58
Project: community-edition-old   File: UpdateDwsDataEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Update dws data for site
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse})
 */
@SuppressWarnings("unchecked")
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
    {
        logger.debug("SOAP method with name " + getName() + " is started.");
    }
    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    XPath updatesPath = new Dom4jXPath(buildXPath(prefix, "/UpdateDwsData/updates"));
    updatesPath.setNamespaceContext(nc);
    Element updates = (Element) updatesPath.selectSingleNode(soapRequest.getDocument().getRootElement());

    Document updatesDocument = DocumentHelper.parseText(updates.getText());
    XPath setVarPath = new Dom4jXPath("/Batch/Method/SetVar");
    List<Element> list = setVarPath.selectNodes(updatesDocument);

    LinkBean link = createLink(list);
    XPath methodPath = new Dom4jXPath("/Batch/Method");
    CAMLMethod method = CAMLMethod.value(((Element) methodPath.selectSingleNode(updatesDocument)).attributeValue("ID"));

    Element root = soapResponse.getDocument().addElement("UpdateDwsDataResponse", namespace);
    Element updateDwsDataResult = root.addElement("UpdateDwsDataResult");
    Element results = updateDwsDataResult.addElement("Results");
    Element result = results.addElement("Result");
    result.addAttribute("ID", method.toString());
    result.addAttribute("Code", "0");

    try
    {
        link = handler.updateDwsData(link, method, VtiPathHelper.removeSlashes(getDwsFromUri(soapRequest)));
    }
    catch (VtiHandlerException e)
    {
        if (e.getMessage().equals(VtiHandlerException.ITEM_NOT_FOUND))
        {
            result.addElement("Error").addAttribute("ID", "5");
            return;
        }
        else if (e.getMessage().equals(VtiHandlerException.LIST_NOT_FOUND))
        {
            result.addElement("Error").addAttribute("ID", "7");
            return;
        }
        else
        {
            throw e;
        }
    }

    if (method.toString().equals("New"))
    {
        result.addText(generateXml(link));
    }
    else
    {
        result.addAttribute("List", "");
        result.addAttribute("Version", "0");
    }

    if (logger.isDebugEnabled())
    {
        logger.debug("SOAP method with name " + getName() + " is finished.");
    }
}
 
Example 59
Project: community-edition-old   File: GetMeetingWorkspacesEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Retrieve the list of Meeting Workspaces on specified Alfresco Server
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse})
 */
public void execute(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse) throws Exception
{
    if (logger.isDebugEnabled())
        logger.debug("Soap Method with name " + getName() + " is started.");

    String site = getDwsFromUri(soapRequest);

    if (site.length() > 0)
    {
        throw new RuntimeException(new String(I18NUtil.getMessage("vti.meeting.error.subsites").getBytes("ISO-8859-1"), "UTF-8"));
    }

    // mapping xml namespace to prefix
    SimpleNamespaceContext nc = new SimpleNamespaceContext();
    nc.addNamespace(prefix, namespace);
    nc.addNamespace(soapUriPrefix, soapUri);

    Element requestElement = soapRequest.getDocument().getRootElement();

    // Did they request recurring information?
    // NOTE - The meaning of this flag is currently unclear, and a TDI is open for it
    // Based on the eventual response, the current boolean may need to become a 
    //  Boolean, or may need to become two booleans.
    if (logger.isDebugEnabled())
        logger.debug("Getting recurring from request.");
    XPath recurringPath = new Dom4jXPath(buildXPath(prefix, "/GetMeetingWorkspaces/recurring"));
    recurringPath.setNamespaceContext(nc);
    Element recurringE = (Element) recurringPath.selectSingleNode(requestElement);

    boolean recurring = false;
    if (recurringE != null)
    {
        recurring = Boolean.parseBoolean(recurringE.getText());
    }
    
    // Fetch the sites
    List<SiteInfo> sites = handler.getMeetingWorkspaces(recurring);

    // creating soap response
    Element root = soapResponse.getDocument().addElement("GetMeetingWorkspacesResponse", namespace);
    Element meetingWorkspaces = root.addElement("GetMeetingWorkspacesResult").addElement("MeetingWorkspaces");

    String baseUrl = getHost(soapRequest) + soapRequest.getAlfrescoContextName() + "/";

    for (SiteInfo siteInfo : sites)
    {
        Element workspace = meetingWorkspaces.addElement("Workspace");
        workspace.addAttribute("Url", baseUrl + siteInfo.getShortName());
        workspace.addAttribute("Title", siteInfo.getTitle());
    }

    soapResponse.setContentType("text/xml");
    if (logger.isDebugEnabled())
    {
        logger.debug("SOAP method with name " + getName() + " is finished.");
    }
}
 
Example 60
Project: community-edition-old   File: AbstractMeetingFromICalEndpoint.java   Source Code and License 4 votes vote down vote up
/**
 * Add new meeting to Meeting Workspace
 * 
 * @param soapRequest Vti soap request ({@link VtiSoapRequest})
 * @param soapResponse Vti soap response ({@link VtiSoapResponse})
 */
@Override
protected void executeRequest(VtiSoapRequest soapRequest, VtiSoapResponse soapResponse, String siteName,
        Element requestElement, SimpleNamespaceContext nc) throws Exception
{
    // getting organizerEmail parameter from request
    XPath organizerEmailPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/organizerEmail"));
    organizerEmailPath.setNamespaceContext(nc);
    Element organizerEmailE = (Element) organizerEmailPath.selectSingleNode(requestElement);
    String organizerEmail = null;
    if (organizerEmailE != null && organizerEmailE.getText() != null)
    {
        organizerEmail = organizerEmailE.getText();
    }
    if (logger.isDebugEnabled())
        logger.debug("Getting organizerEmail from request: " + organizerEmail);

    // getting icalText parameter from request
    XPath icalTextPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/icalText"));
    icalTextPath.setNamespaceContext(nc);
    Element icalTextE = (Element) icalTextPath.selectSingleNode(requestElement);
    String icalText = null;
    if (icalTextE != null && icalTextE.getText() != null)
    {
        icalText = icalTextE.getText();
    }
    if (logger.isDebugEnabled())
        logger.debug("Getting icalText from request: " + icalText);
    
    // Get the ignoreAttendees parameter from request
    // Controls if this is a scheduling only update, or if attendees are affected too
    if (logger.isDebugEnabled())
        logger.debug("Getting ignoreAttendees from request.");
    XPath ignoreAttendeesPath = new Dom4jXPath(buildXPath(prefix, "/"+getName()+"/ignoreAttendees"));
    ignoreAttendeesPath.setNamespaceContext(nc);
    Element ignoreAttendeesE = (Element) ignoreAttendeesPath.selectSingleNode(requestElement);
    boolean ignoreAttendees = false;
    if (ignoreAttendeesE != null && ignoreAttendeesE.getText() != null)
    {
        ignoreAttendees = Boolean.parseBoolean(ignoreAttendeesE.getText());
    }

    // Turn the iCal text into an object we can use/store
    MeetingBean meetingBean = getMeeting(icalText);

    // Have the action done
    executeMeetingAction(soapRequest, soapResponse, siteName, meetingBean, -1, -1, ignoreAttendees, false);
}