UWP and FullTrustProcessLauncher missing in namaspeace - powershell

I am trying to launch powershell (some lightweight commands that all user can do) command from UWP application using FullTrustProcessLauncher.
Problem is I am getting that this name does not exists in current context.
My manifest is largly default so it looks like :
<?xml version="1.0" encoding="utf-8"?>
<Package
xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10"
IgnorableNamespaces="uap mp">
<Dependencies>
<TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0" />
</Dependencies>
<Resources>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="PrototypeProject.App">
<Extensions>
<desktop:Extension Category="windows.fullTrustProcess" Executable="powershell.exe">
<desktop:FullTrustProcess>
<desktop:ParameterGroup GroupId="TestGroup" Parameters="ls"/>
</desktop:FullTrustProcess>
</desktop:Extension>
</Extensions>
</Application>
</Applications>
<Capabilities>
<Capability Name="internetClient" />
<rescap:Capability Name="runFullTrust"/>
</Capabilities>
</Package>
And class I am trying to call it from looks like:
using Windows.ApplicationModel;
using Windows.Foundation;
namespace FullTrustProcess
{
public class Ftp
{
public const string FtpParamGroupId = "TestGroup";
public void RunFtp()
{
IAsyncAction operation = FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(FtpParamGroupId);
}
}
}
Now am I missing something??

It looks like I was missing - Windows Desktop Extensions for the UWP, in extensions reference

Related

JBoss Fuse CXF-RS REST Issue - 'No services have been found'

I'm creating a REST Service with Apache Camel and CXF-RS, using the following tutorial: https://www.javainuse.com/camel/apache_camel_rest_cxfrs
I've set up the code as shown in the tutorial and followed the steps correctly. After building the Maven project, I have successfully been able to install the bundle on Apache Karaf, using the SNAPSHOT file created. (A new Bundle ID was created).
When I run the command to 'start' the newly created bundle, it seemingly works with no errors being shown. However, when I access http://localhost:8181/cxf as mentioned towards the end of the tutorial, it says 'No services have been found':
Can you please advise me on what could be causing this problem?
Thank you.
My Project Structure:
My Code:
pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.fuseproject</groupId>
<artifactId>camel-cxfrs-core</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<repositories>
<repository>
<id>Central2</id>
<name>Central2</name>
<url>https://repo.maven.org/maven2</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>2.12.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<version>2.4.0</version>
</plugin>
</plugins>
</build>
</project>
CamelProcessor.java:
package com.fuseproject.beans;
import org.apache.camel.Exchange;
import org.apache.camel.Processor;
public class CamelProcessor implements Processor {
public void process(Exchange exchange) throws Exception {
// Get input from exchange
String msg = exchange.getIn().getBody(String.class);
// set output in exchange
exchange.getOut().setBody("Hello World " + msg);
}
}
EmployeeServiceResource.java:
package com.fuseproject.beans;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
#Path("/")
public class EmployeeServiceResource {
public EmployeeServiceResource() {
}
#GET
#Path("/employees/{name}/")
public String getCustomer(#PathParam("name") String name) {
return null;
}
}
applicationContext.xml:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/cxf"
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd
http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd
http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
<cxf:rsServer id="restService" address="http://localhost:9000/employeeservice"
serviceClass="com.fuseproject.beans.EmployeeServiceResource">
</cxf:rsServer>
<bean id="processor" class="com.fuseproject.beans.CamelProcessor" />
<camelContext id="camelId" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxfrs://bean://restService" />
<process ref="processor" />
</route>
</camelContext>
</beans>

terracotta open source not working in ecache.xml - terracotta:clustered-shared

I am migrating from ehcache 2 to ehcache 3.5. I am trying to use terracotta open source for sharing the cache with clusters.
Below is my java code,
final CacheManagerBuilder<PersistentCacheManager> clusteredCacheManagerBuilder =
CacheManagerBuilder.newCacheManagerBuilder()
.with(ClusteringServiceConfigurationBuilder.cluster(URI.create("terracotta://terr.com:9410/clustered")).autoCreate()
.defaultServerResource("default-resource")
.resourcePool("pool3", 28, MemoryUnit.MB))
.withCache("boxMaxFileId", CacheConfigurationBuilder.newCacheConfigurationBuilder(String.class, Integer.class,
ResourcePoolsBuilder.newResourcePoolsBuilder()
.with(ClusteredResourcePoolBuilder.clusteredShared("pool3")))) ;
final PersistentCacheManager cacheManager = clusteredCacheManagerBuilder.build(true);
LOGGER.info(cacheManager.getStatus().toString());
return cacheManager;
Can someone help me in getting converted to ehcache.xml
<ehcache:service>
<terracotta:cluster>
<terracotta:connection url="terracotta://terr.com:9410/clustered"/>
<terracotta:server-side-config auto-create="true">
<terracotta:default-resource from="default-resource"/>
<terracotta:shared-pool name="pool1" unit="MB">2</terracotta:shared-pool>
</terracotta:server-side-config>
</terracotta:cluster>
</ehcache:service>
<ehcache:cache alias="boxMaxFileId">
<ehcache:key-type>java.lang.String</ehcache:key-type>
<ehcache:value-type>java.lang.Integer</ehcache:value-type>
<ehcache:resources>
<ehcache:heap unit="entries">100</ehcache:heap>
<ehcache:offheap unit="MB">1</ehcache:offheap>
<terracotta:clustered-shared sharing="pool1" />
</ehcache:resources>
</ehcache:cache>
tc-config.xml
<plugins>
<config>
<ohr:offheap-resources>
<ohr:resource name="default-resource" unit="MB">512</ohr:resource>
</ohr:offheap-resources>
</config>
</plugins>
I am getting exception like Pool name "pool1" not exists in server.
<?xml version="1.0" encoding="UTF-8"?>
<ehcache:config
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:jsr107='http://www.ehcache.org/v3/jsr107'
xmlns:terracotta='http://www.ehcache.org/v3/clustered'
xmlns:ehcache='http://www.ehcache.org/v3'
xsi:schemaLocation="http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.1.xsd
http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.5.xsd
http://www.ehcache.org/v3/clustered http://www.ehcache.org/schema/ehcache-clustered-ext-3.1.xsd">
<ehcache:service>
<terracotta:cluster>
<terracotta:connection url="terracotta://terr.com:9410/clustered"/>
<terracotta:server-side-config auto-create="true">
<terracotta:default-resource from="default-resource"/>
<terracotta:shared-pool name="pool1" from="default-resource" unit="MB">2</terracotta:shared-pool>
</terracotta:server-side-config>
</terracotta:cluster>
</ehcache:service>
<ehcache:cache alias="boxMaxFileId">
<ehcache:key-type>java.lang.String</ehcache:key-type>
<ehcache:value-type>java.lang.Integer</ehcache:value-type>
<ehcache:resources>
<ehcache:heap unit="entries">100</ehcache:heap>
<ehcache:offheap unit="MB">1</ehcache:offheap>
<!-- <terracotta:clustered-dedicated unit="MB">5</terracotta:clustered-dedicated>-->
<terracotta:clustered-shared sharing="pool1" />
</ehcache:resources>
</ehcache:cache>
</ehcache:config>
This is the converted xml. For sharing, we need to use the above format.

read nuget.config programmatically in c#

Is it possible to read nuget.config file and packages sources inside with using Nuget.visualStudio,nuget.core or nuget.clients dll.I can parse xml but is there any outofthebox logic in nuget.dlls
Yes! You need to consume the NuGet.Configuration package available at https://www.nuget.org/packages/NuGet.Configuration/4.6.2.
Then you can use the following code -
using NuGet.Configuration;
using System;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
// basic implementation of nuget.config in code
var setting = Settings.LoadSpecificSettings(#"f:\root", "nuget.config");
// get sources
var packageSourceProvider = new PackageSourceProvider(setting);
var sources = packageSourceProvider.LoadPackageSources();
foreach(var source in sources)
{
Console.WriteLine($"{source.Name}: {source.SourceUri}");
}
}
}
}
This will generate the following output -
NuGet.org: https://api.nuget.org/v3/index.json
Sample config file used (lets say at path f:\root\nuget.config)-
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="NuGet.org" value="https://api.nuget.org/v3/index.json" />
</packageSources>
</configuration>

Web.config custom section not being recognized

I am trying to develop an application that uses the package SAML2.dll (which I downloaded with NuGet). To properly configure my application, we must add a few sections in the Web.config file:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
**<section name="saml2" type="SAML2.Config.Saml2Section, SAML2" />**
</configSections>
<connectionStrings>...</connectionStrings>
<appSettings>...</appSettings>
<system.web>...</system.web>
<system.webServer>
<modules>
<remove name="FormsAuthentication" />
</modules>
**<handlers>
<remove name="SAML2.Protocol.Saml20SignonHandler" />
<remove name="SAML2.Protocol.Saml20LogoutHandler" />
<remove name="SAML2.Protocol.Saml20MetadataHandler" />
<add name="SAML2.Protocol.Saml20SignonHandler" verb="*" path="Login.ashx" type="SAML2.Protocol.Saml20SignonHandler, SAML2" />
<add name="SAML2.Protocol.Saml20LogoutHandler" verb="*" path="Logout.ashx" type="SAML2.Protocol.Saml20LogoutHandler, SAML2" />
<add name="SAML2.Protocol.Saml20MetadataHandler" verb="*" path="Metadata.ashx" type="SAML2.Protocol.Saml20MetadataHandler, SAML2" />
</handlers>**
</system.webServer>
<runtime>...</runtime>
<entityFramework>...</entityFramework>
**<saml2>
<serviceProvider id="urn:issuer" server="http://localhost:3301/">
<endpoints>
<endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
<endpoint localpath="Logout.ashx" type="logout" redirectUrl="~/HomePage" />
<endpoint localpath="Metadata.ashx" type="metadata" />
</endpoints>
<nameIdFormats allowCreate="true">
<add format="urn:oasis:names:tc:SAML:2.0:nameid-format:transient" />
</nameIdFormats>
<authenticationContexts comparison="Exact">
<add context="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" referenceType="AuthnContextClassRef" />
</authenticationContexts>
</serviceProvider>
<identityProviders metadata="C:\Users\myUser\Desktop\testMetadata\metadata_Kit_net.xml" />
<metadata>
<contacts>
<contact type="Administrative" company="" givenName="" surName="" email="" phone="" />
</contacts>
<requestedAttributes>
<add name="urn:cn" />
</requestedAttributes>
</metadata>
</saml2>**
</configuration>
The issue is that the session tag has no recognized tags, I'm having 39 messages like (one for each element inside the tag):
impossible to find schema information for the element 'saml2'.
impossible to find schema information for the element 'serviceProvider'.
impossible to find schema information for the element 'id'.
...
I looked into my dll's source code (SAML2.dll) and it seams to have all the tags definitions (as written in the first Web.config part: ):
using System.Configuration;
namespace SAML2.Config
{
/// <summary>
/// SAML2 Configuration Section.
/// </summary>
public class Saml2Section : ConfigurationSection
{
/// <summary>
/// Gets the section name.
/// </summary>
public static string Name { get { return "saml2"; } }
#region Elements
/// <summary>
/// Gets or sets the actions to perform on successful processing.
/// </summary>
/// <value>The actions.</value>
[ConfigurationProperty("actions")]
public ActionCollection Actions
{
get { return (ActionCollection)base["actions"]; }
set { base["actions"] = value; }
}
/// <summary>
/// Gets or sets the identity providers.
/// </summary>
/// <value>The identity providers.</value>
[ConfigurationProperty("identityProviders")]
public IdentityProviderCollection IdentityProviders
{
get { return (IdentityProviderCollection)base["identityProviders"]; }
set { base["identityProviders"] = value; }
}
/// <summary>
/// Gets or sets the metadata.
/// </summary>
/// <value>The metadata.</value>
[ConfigurationProperty("metadata")]
public MetadataElement Metadata
{
get { return (MetadataElement)base["metadata"]; }
set { base["metadata"] = value; }
}
/// <summary>
/// Gets or sets the service provider.
/// </summary>
/// <value>The service provider.</value>
[ConfigurationProperty("serviceProvider")]
public ServiceProviderElement ServiceProvider
{
get { return (ServiceProviderElement)base["serviceProvider"]; }
set { base["serviceProvider"] = value; }
}
...
When I call the URL http://localhost:3301/Login.ashx, I'm having the error:
{"Attribute 'localpath' not recognized. (c:\users\myUser\documents\visual studio 2013\Projects\saml20app\saml20app\web.config line 98)"}, and it points exactly to the line
<endpoint localpath="Login.ashx" type="signon" redirectUrl="~/AuthenticatedHomePage" />
Can someone please help me with this error?
Thanks in advance for your help,
Marc
Got tried of trying to get this to work so I opened the assembly with ILSpy to see what it wanted:
<endpoint localPath="Login.ashx" type="SignOn" redirectUrl="~/AuthenticatedHomePage" />
<endpoint localPath="Logout.ashx" type="Logout" redirectUrl="~/HomePage" />
<endpoint localPath="Metadata.ashx" type="Metadata" />
The type attribute in the example web.config makes it unhappy too. Thankfully it lets you know the enumerated values it expects.
Hope this help.

How to change the preferences so that each window displays something different?

I'm trying to override values of preferences, but nothing overrides.
Does anyone know how to fix this?
portlet.xml
<?xml version="1.0" encoding="UTF-8"?>
<portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.0" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_2_0.xsd">
<portlet>
<portlet-name>cool_portlet</portlet-name>
<portlet-class>org.springframework.web.portlet.DispatcherPortlet</portlet-class>
<supports>
<mime-type>text/html</mime-type>
<portlet-mode>view</portlet-mode>
</supports>
<supported-locale>en</supported-locale>
<resource-bundle>com.app.portlet.cool_portlet</resource-bundle>
<portlet-info>
<title>Cool Portlet</title>
</portlet-info>
<portlet-preferences>
<preference>
<name>KEY</name>
<value>TEST</value>
<read-only>false</read-only>
</preference>
</portlet-preferences>
</portlet>
</portlet-app>
portlet-instances.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
<deployment>
<instance>
<instance-id>coolPortlet_IMPORT_newInstance</instance-id>
<portlet-ref>cool_portlet</portlet-ref>
<preferences>
<name>KEY</name>
<value>IMPORT</value>
</preferences>
</instance>
</deployment>
<deployment>
<instance>
<instance-id>coolPortlet_EXPORT_newInstance</instance-id>
<portlet-ref>cool_portlet</portlet-ref>
<preferences>
<name>KEY</name>
<value>EXPORT</value>
</preferences>
</instance>
</deployment>
</deployments>
cool_portlet-object.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE deployments PUBLIC "-//JBoss Portal//DTD Portlet Instances 2.6//EN" "http://www.jboss.org/portal/dtd/portlet-instances_2_6.dtd">
<deployments>
<deployment>
<parent-ref>comportal.import</parent-ref>
<if-exists>overwrite</if-exists>
<window>
<window-name>impWindow</window-name>
<content>
<content-type>portlet</content-type>
<content-uri>coolPortlet_IMPORT_newInstance</content-uri>
</content>
<region>center</region>
<height>1</height>
<supported-window-states>
<window-state>normal</window-state>
<window-state>maximized</window-state>
<window-state>minimized</window-state>
</supported-window-states>
<initial-window-state>normal</initial-window-state>
</window>
</deployment>
<deployment>
<parent-ref>comportal.export</parent-ref>
<if-exists>overwrite</if-exists>
<window>
<window-name>expWindow</window-name>
<content>
<content-type>portlet</content-type>
<content-uri>coolPortlet_EXPORT_newInstance</content-uri>
</content>
<region>center</region>
<height>1</height>
<supported-window-states>
<window-state>normal</window-state>
<window-state>maximized</window-state>
<window-state>minimized</window-state>
</supported-window-states>
<initial-window-state>normal</initial-window-state>
</window>
</deployment>
</deployments>
MainController.java
#RequestMapping(value = "VIEW")
#Controller(value = "mainController")
public class MainController {
#RenderMapping
public String init(#RequestParam(value = "key", required = false) String key, Model model, PortletRequest request) throws Exception {
PortletPreferences preferences = request.getPreferences();
String preferencesKey = preferences.getValue("KEY", "Not Found!!!");
System.out.println("KEY is : " + preferencesKey);
model.addAttribute("preferencesKey", preferencesKey);
return "index";
}
}
Output:
13:49:54,860 INFO [STDOUT] KEY is : TEST
13:50:21,088 INFO [STDOUT] KEY is : TEST
You need to call setValue and then store your PortletPreferences object. Note that preferences can only be stored in action phase. visit