Using JSF Composite Component with JBoss EAP 6.2 Modules - jsf-2

How can I expose composite components to JBoss through modules? The component works correctly in the same project, the project can correctly refer to other classes within the depended on module, but attempting to use a composite component throws out an error like
/common/common.xhtml #30,36 <NAMESPACE:COMPONENT> Tag Library supports namespace: http://java.sun.com/jsf/composite/NAMESPACE, but no tag was defined for name: COMPONENT
I've currently modified my jboss-deployment-structure.xml to the following, but it hasn't made any difference.
<module name="deployment.CompositeComponentProject.war" export="true" meta-inf="export">
<imports>
<include path="**"/>
</imports>
</module>

Related

How do you handle multiple application classes in a xamarin android project

There is a 3rd party library I need to use, that includes a class decorated with the [Application] attribute. This causes compiler errors since I have my own application class that uses an [Application] attribute. I would like my application class to inherit from the 3rd party lib's application class.
public class MyApplication : ThirdPartyApplication
{
}
however since I can't decorate my class with the [Application] attribute I have no way to specify in the Manifest that it should run "MyApplication" and not "ThirdPartyApplication".
If I manually add an entry into AndroidManifest.xml
<application
android:name="com.your.packagename.MyApplication"
android:icon="#drawable/luncher_icon"
android:label="#string/app_name">
It will get replaced after the project gets built with
<application
android:name="mdxxx.ThirdPartyApplication"
android:icon="#drawable/luncher_icon"
android:label="#string/app_name">
Does anyone know how to handle this situation in Xamarin Android?
Keep in mind that the 3rd party library can not be modified.
An alternate solution would be a way to disable all manifest generating attributes and manually create the AndroidManifest. There does not seem to be any way to do this either.
The below post is the exact situation I am having but in pure Android. Note that due to the above issues that this solution will not work for Xamarin.
how-to-handle-multiple-application-classes-in-android
So I was able to figure out a solution but it boarders on being a hack.
In short the android manifest is going to be modified using MSBuild.
Step 1: Have your custom application class inherit from the the Third Party lib's custom application and decorate your class with the "Register" tag.
[Register("com.namespace.MyApplication")]
public class MyApplication : ThirdPartyApplication
{
}
Step 2: Have your project include the RoslynCodeTaskFactory NuGet package
Step 3: Unload your project, then add the following in the Project tag
<UsingTask TaskName="UpdateManifest" TaskFactory="CodeTaskFactory" AssemblyFile="$(RoslynCodeTaskFactory)" Condition=" '$(RoslynCodeTaskFactory)' != '' ">
<ParameterGroup>
<AndroidManifestFilename ParameterType="System.String" Required="true" />
<ApplicationName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.Xml" />
<Code Type="Fragment" Language="cs"><![CDATA[
XmlDocument doc = new XmlDocument();
doc.Load(AndroidManifestFilename);
XmlNode node = doc.DocumentElement.SelectSingleNode("/manifest/application");
node.Attributes["android:name"].InnerText = ApplicationName;
doc.Save(AndroidManifestFilename);
]]></Code>
</Task>
</UsingTask>
<Target Name="CleanManifest" AfterTargets="_GenerateJavaStubs">
<UpdateManifest AndroidManifestFilename="$(ProjectDir)\obj\$(Configuration)\android\AndroidManifest.xml" ApplicationName="com.namespace.MyApplication" />
</Target>
Step 4: Reload the project and build. The manifest should now point to custom application class. If you get a class not found runtime exception most likely you forgot to add [Register] from Step 1.

How do I get IDE code completion to work with JSF 2.2 non-composite component attributes?

Problem: I get code completion on the tags but not the attributes.
I am working on a new web application using
Java 8
JSF 2.2.14
PrimeFaces 6.1
Netbeans 8.2
We are using a library that is provided to us in JavaScript (generated from Typescript sources). I have written a non-composite component to wrap this library and keep all that JavaScript code hidden and in one place. It initializes the the library and provides attributes to pass JavaScript callback functions to the library (so we still have to write some JavaScript).
snippet from the JSF .xhtml file
<script type="text/javascript">
function jscallbackHandler() { alert("function called!");}
</script>
<myComponent:initialize callback1="jscallbackHandler" />
This tag invokes my class to write a lot of JavaScript into the page to setup and initialize the library.
I am using the #FacesComponent annotation to declare my classes as custom components.
snippet from 'InitMyComponent.java' file
#FacesComponent(createTag = true,
tagName = "initialize",
namespace = "https://com.my.project/myComponent",
value = InitMyComponent.FAMILY)
public class InitMyComponent extends UIComponentBase { ... }
This is working except for IDE code completion and I can't find documentation or examples for JSF 2.2 components that show how to declare attributes and hook them into the project. I have seen many examples of earlier JSF 2.x components that use a taglib.xml to define the attributes for code completion, but it seems to be 'at odds' with features of the JSF 2.2 style annotation. I have to remove most of the attributes of the annotation (basically revert to a JSF 2.0 style annotation) or I get "Expression Error: Named Object ... not found". I have also gotten Tag Library supports namespace, but no tag was defined for name. If I just provide a component name to the annotation that matches the one in the taglib file it works, but just no code completion.
I have a FACELETS_LIBRARIES name/value pair in a context-param tag in the web.xml to declare where my facelet-taglib file is located.
snippet from the 'web.xml' file
<!-- Enable IDE autocompletion on component attributes -->
<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/myComponent.taglib.xml</param-value>
</context-param>
I have a facelet-taglib file named 'myComponent.taglib.xml' in my WEB-INF directory (same place as faces-config.xml and web.xml).
UPDATE: Responding to the comment by Kukeltje, I updated my facelet-taglib file to version 2.2, but I still get "No Suggestions" from my IDE... also updated the namespaces in my .xhtml JSF source file (even though this site said the older versions were still supported
https://jsflive.wordpress.com/2013/05/16/jsf22-namespaces/)
snippet from the 'myComponent.taglib.xml' file
<?xml version="1.0"?>
<facelet-taglib version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd">
<namespace>http://java.sun.com/jsf/composite/components</namespace>
<composite-library-name>myComposites</composite-library-name>
<namespace>https://com.my.project/myComponent</namespace>
<tag>
<tag-name>initialize</tag-name>
<component>
<component-type>InitMyComponent</component-type>
</component>
<attribute>
<name>callback1</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
</tag>
The faces-config.xml file - defines the javaee and schema namespaces, and version 2.2 but it is otherwise 'empty'.
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd"
version="2.2">
</faces-config>
I am fine with having to type in all the attributes but I just can't seem to find the proper way to hook this feature into my project.
Note: I have experimented with using a composite component. The code completion for attributes worked, but then I lost code completion for the tags. I'm just writing out JavaScript to setup and call a JavaScript library's initialize function but also, I would really love to pass a JavaScript object back to a bean on the server when my callback function is invoked. I am currently using a BalusC provided solution that involves p:remoteCommand and updating hidden input fields. I would greatly prefer to provide reference to the bean using EL in an attribute of my custom component.

Visual Studio (Xamarin): DependencyService + Nuget + iOS = Fail

We are writing a Visual Studio (Xamarin) cross-platform application that will share quite a bit of functionality with the next application we write, so we wanted to put that shared functionality into a "library" so we could test it, share it easily, etc.
The only way we found to write a cross-platform library, is to create it using the standard Xamarin DependencyService paradigm, turn it into a NuGet package, and then load that package into our main app. For better or worse, we did this before Microsoft provided a template for generating NuGet libraries like this, so we had to roll it ourselves.
This works fine for Android, but now I'd like to get the same code working for iOS and it's simply not working. No errors, no warnings, but when I run the app and call
Client = DependencyService.Get<IClient>();
It simply returns null. If I look at the Output/Debug window, it is loading the 'Company.Client.Abstractions.dll' (the root DLL containing the definition of IClient) but not the iOS-specific 'Company.Client.dll' (which contains the iOS-specific implementation of IClient).
Here's my nuspec file:
<?xml version="1.0"?>
<package >
<metadata>
<id>Client</id>
<version>0.0.35</version>
<authors>Me</authors>
<owners>Company</owners>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>Stuff</description>
<releaseNotes>Initial release</releaseNotes>
<copyright>Copyright 2017 Company</copyright>
<dependencies>
<group targetFramework="MonoAndroid">
<dependency id="Xamarin.Forms" version="2.3.4.247" />
</group>
<group targetFramework="Xamarin.iOS10">
<dependency id="Xamarin.Forms" version="2.3.4.247" />
</group>
<group targetFramework="uap">
<dependency id="Xamarin.Forms" version="2.3.4.247" />
</group>
</dependencies>
</metadata>
<files>
<!-- Cross-platform reference assemblies -->
<file src="Company.Client.Abstractions\bin\Debug\Company.Client.Abstractions.dll" target="lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\Company.Client.Abstractions.dll" />
<file src="Company.Client.Abstractions\bin\Debug\Company.Client.Abstractions.pdb" target="lib\portable-net45+win+wpa81+wp80+MonoAndroid10+xamarinios10+MonoTouch10\Company.Client.Abstractions.pdb" />
<!-- iOS reference assemblies -->
<file src="Company.Client.iOS\bin\iPhone\Debug\Company.Client.dll" target="lib\Xamarin.iOS10\Company.Client.dll" />
<file src="Company.Client.iOS\bin\iPhone\Debug\Company.Client.pdb" target="lib\Xamarin.iOS10\Company.Client.pdb" />
<!-- Android reference assemblies -->
<file src="Company.Client.Android\bin\Debug\Company.Client.dll" target="lib\MonoAndroid10\Company.Client.dll" />
<file src="Company.Client.Android\bin\Debug\Company.Client.pdb" target="lib\MonoAndroid10\Company.Client.pdb" />
<!-- UWP reference assemblies -->
<file src="Company.Client.UWP\bin\Debug\Company.Client.dll" target="lib\UAP10\Company.Client.dll" />
<file src="Nuvectra.Client.UWP\bin\Debug\Company.Client.pdb" target="lib\UAP10\Company.Client.pdb" />
</files>
</package>
I'm thinking there are two classes of possible problems:
I'm generating the DLL wrong
I'm generating the application wrong
Looking at the generated DLLs, the Android DLL is 28k long, the iOS DLL is 23k, so it doesn't look like the iOS DLL is empty. Is there a tool that would let me inspect the iOS DLL and make sure it has the necessary entry point(s)?
The Project that generates the iOS DLL has these settings:
Target framework: Xamarin.iOS
Output type: Class Library
Condition compilation symbols: __ UNIFIED__;__ MOBILE__;__ IOS__
Platform: Active (Any CPU)
The application that is using the DLL has these settings for the iOS Project:
SDK Version: Default
Linker Behavior: Don't Link
Platform: Active (iPhone)
Supported Architectures: ARMv7 + ARM64
Target framework: Xamarin.IOS
Output type: Console Application
Conditional compilation symbols: __ UNIFIED__;__ MOBILE__;__ IOS__
The interface definition in my 'Abstractions' project looks like this:
namespace Company.Client
{
public abstract class IClient
{
void abstract function();
}
}
and the implementation in my iOS project looks like this:
using Company.Client.iOS;
[assembly: Xamarin.Forms.Dependency (typeof (IosClient))]
namespace Company.Client.iOS
{
public class IosClient : IClient
{
void override function();
}
}
We tried many different ways to create a NuGet package with platform-specific code loaded using DependencyService and every single way had the same problem - worked fine under Android, failed under iOS.
The solution is to create a class in the iOS library that is not loaded using DependencyService, and then in the iOS application, create an instance of that class. That's enough to convince the iOS application that it actually needs to load the iOS library DLL, and then the rest of the DependencyService magic works correctly.

Why isn't my standard RSL being loaded?

I've created a modular application where a parent SWF loads a number of other SWFs on demand. For optimization, I've created a standard RSL.
I've compiled common code into a swc, and recompiled the application swfs to reference this swc, using the following in my build.xml ANT task (for each swf in my application):
<static-link-runtime-shared-libraries>false</static-link-runtime-shared-libraries>
<runtime-shared-library-path path-element="${lib.loc}/RSL.swc">
<url rsl-url="RSL.swf"/>
</runtime-shared-library-path>
I've extracted RSL.swf from RSL.swc and put this on my webserver in the same directory as the application swfs and container html file.
Now when I load my application, I get the message:
VerifyError: Error #1014: Class mx.core:BitmapAsset could not be found.
I can see this class included in the classes in RSL.swc / RSL.swf.
I've used fiddler to observe what is happening and I can see my Application swf file is loaded, but no attempt is made to get the RSL.swf.
Having set up the Application.swf file to use RSLs, I would have expected it to attempt loading RSL.swf before initialising, however this doesn't happen. Can anyone suggest why?
From http://livedocs.adobe.com/flex/3/html/help.html?content=rsl_02.html:
"You cannot use RSLs in ActionScript-only projects if the base class is Sprite or MovieClip. RSLs require that the application's base class, such as Application or SimpleApplication, understand RSL loading."
As my base class was Sprite, I had this error.
In my case, it was better to compile all the required classes into my Application swf file, using the following steps:
use compc to create a SWC with the files I want to include in my Application swf file
use mxmlc with include-libraries pointing to the SWC file to include. Generate a linked file report (xml) using link-report
compile each additional child swf with load-externs pointing to the linked file report (xml) - this excludes the files linked to the Application.swf from being compiled into each of the child swfs
To achieve step 1:
<!-- We define the global classes which will be compiled into the parent Application
swf, but excluded from the tool swfs. As pure actionscript projects with base
class of Sprite can't usually use RSLs, we are forcing these classes to be loaded
into the parent application, and excluded from the child applications, allowing an
"Rsl-like" optimisation -->
<fileset id="rsl.inclusions" dir="${main.src.loc}">
<include name="${main.src.loc}/path1/**/*.as"/>
<include name="${main.src.loc}/path2/**/*.as"/>
...
</fileset>
<pathconvert property="rsl.classes" pathsep=" " refid="rsl.inclusions">
<chainedmapper>
<globmapper from="${main.src.loc}\*" to="*"/>
<mapper type="package" from="*.as" to="*"/>
</chainedmapper>
</pathconvert>
<!-- Compile SWC -->
<compc output="${lib.loc}/MySwc.swc"
include-classes="${rsl.classes}">
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<source-path path-element="${main.src.loc}"/>
</compc>
To achieve step 2:
<mxmlc file="${main.src.loc}/pathToApp/Application.as"
output="${bin.loc}/Application.swf"
debug="${debug}"
use-network="true"
link-report="WorkbenchLinkReport.xml"
fork="true">
<compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<include-libraries dir="${lib.loc}" append="true">
<include name="MySwc.swc" />
</include-libraries>
</mxmlc>
To achieve step 3:
<mxmlc file="${main.src.loc}/pathToChildSwf1/Child1.as"
output="${bin.loc}/Child1.swf"
debug="${debug}"
load-externs="WorkbenchLinkReport.xml"
fork="true">
<compiler.source-path path-element="${main.src.loc}" />
<static-link-runtime-shared-libraries>true</static-link-runtime-shared-libraries>
<compiler.headless-server>true</compiler.headless-server>
</mxmlc>
Another handy tip: using fork="true" prevents the Java VM running out of memory where many swfs are being compiled.
Hope this is helpful!

Spring.Net without App.config

I want to configure the spring.net in some other setting files like xml not through app.config.
Is it possible to configure the spring.net in xml not in app.config file.if yes how can i do it.
Yes, you can place your configuration in normal xml files. In the Spring.NET documentation, the following example is given:
services.xml:
<objects xmlns="http://www.springframework.net">
<object id="PetStore" type="PetStore.Services.PetStoreService, PetStore">
<property name="AccountDao" ref="AccountDao"/>
<property name="ItemDao" ref="ItemDao"/>
<!-- additional collaborators and configuration for this object go here -->
</object>
<!-- more object definitions for services go here -->
</objects>
The file daos.xml has a similar structure and contains definitions for ItemDao and AccountDao.
In code, you can create an instance of your container using the files services.xml and daos.xml as follows:
IApplicationContext context = new XmlApplicationContext("services.xml", "daos.xml")

Resources