IBM: Add a workflow extension in TIM/SIM - tivoli-identity-manager

I make my first workflow extension today, and the result isn't really good ! :)
I have this error :
CTGIMA411E The sendResult( workflow extension method in the com.orange.tiger.itim.extension.workflow.ResultCallback class cannot be processed.
And the trace.log file:
java.lang.ClassNotFoundException: com.orange.tiger.itim.extension.workflow.ResultCallback
Here this my java code :
package com.orange.tiger.itim.extension.workflow;
//my import
public class ResultCallback implements WorkflowApplication {
private WorkflowExecutionContext context;
private WorkflowProcessEntity processEntity;
public void setContext() {
this.context = null;
}
#Override
public void setContext(WorkflowExecutionContext context) {
//code
}
}
I modify the xml file:
<ACTIVITY ACTIVITYID="sendResult" LIMIT="600000">
<IMPLEMENTATION_TYPE>
<APPLICATION CLASS_NAME="com.orange.tiger.itim.extension.workflow.ResultCallback" METHOD_NAME="sendResult" />
</IMPLEMENTATION_TYPE>
<TRANSITION_RESTRICTION SPLIT="XOR" />
<PARAMETERS>
<IN_PARAMETERS PARAM_ID="summary" TYPE="String" />
<IN_PARAMETERS PARAM_ID="description" TYPE="String" />
</PARAMETERS>
<SCRIPT EVENT="onComplete">
<![CDATA[WorkflowRuntimeContext.setProcessResult(WorkflowRuntimeContext.getActivityResult());
WorkflowRuntimeContext.setProcessResultDetail(WorkflowRuntimeContext.getActivityResultDetail()); ]]>
</SCRIPT>
</ACTIVITY>
I add my jar in /opt/application/tgrtim/products/itim/lib/.
And finally I restart TIM via NDM console.
Maybe I missed something ? Or I did something wrong?
Thanks

I finally found, I forgot to modify a xml file :
/opt/websphere/7.0/profiles/Dmgr01/config/cells/udgis116Cell01/libraries.xml
And add this line : < classPath>${ITIM_HOME}/lib/result-callback.jar< /classPath>

You can also add result-callback.jar directly on Websphere under Environment -> Shared Libraries -> ITIM_LIB -> ${ITIM_HOME}/lib/result-callback.jar

Related

Spring webflow binder not binding collection object

I'm using spring webflow v2.4.8 in my app, and trying to bind the model properties using <binder></binder>. But my collection objects (list1, list2 both ArrayList) never get bound. If I remove the <binder></binder> altogether, all properties are getting correctly bound, but in my case that is not an option.
Do I need to use some custom converter here? Any help greatly appreciated
<view-state id="myId" model="myModel" view="myView" >
<binder>
<binding property="list1"/>
<binding property="list2"/>
<binding property="string1"/>
<binding property="string2"/>
.
.
.
</binder>
.
.
.
</view-state>
It's been a while, but in my project I have a custom ConversionService, so maybe you can try using one like this:
[EDIT]
Here is an example of a converter using a service (that gets the object from the db)
#Named
public class StringToMyType extends StringToObject {
#Inject
private MyTypeService service;
public StringToMyType(MyType myObject) {
super(myObject);
}
#Override
protected Object toObject(String id, Class<?> targetClass) throws Exception {
if (id != null && id.length != 0) {
return service.findById(new Long(id));
} else return null;
}
#Override
protected String toString(Object myObject) throws Exception {
return Objects.toString(((MyType) myObject).getId());
}
}
and add it here
public class CustomDefaultConversionService extends DefaultConversionService {
#Override
protected void addDefaultConverters() {
super.addDefaultConverters();
addConverter(new MyTypeConverter()
addConverter(new ObjectToCollection(this));
}
}
it needs to then be registered this way (xml):
<webflow:flow-builder-services id="flowBuilderServices" view-factory-creator="mvcViewFactoryCreator" conversion-service="conversionService"/>
<bean id="conversionService" class="path.to.converter.CustomDefaultConversionService"/>
hope this helps

Android Wear onPeerConnected not called with new Wear Intents

I have been using the following intent-filter in my manifest and everything worked fine:
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
This has been deprecated so I am trying to use:
<action android:name="com.google.android.gms.wearable.CAPABILITY_CHANGED" />
<action android:name="com.google.android.gms.wearable.MESSAGE_RECEIVED" />
<action android:name="com.google.android.gms.wearable.DATA_CHANGED" />
<action android:name="com.google.android.gms.wearable.CHANNEL_EVENT" />
<data android:scheme="wear" android:host="*" android:pathPrefix="/mypath" />
I can receive messages fine but onPeerConnected never gets called now.
public class WearListenerService extends WearableListenerService {
#Override
public void onPeerConnected(Node peer) {
Log.d("Wear Service", "Peer Connected");
}
#Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.d("Wear Service", "Message Received");
}
}
Everything works perfect if I switch back to using the old BIND_LISTENER instead.
onPeerConnected was deprecated at the same time as BIND_LISTENER, so when you stop using the latter, you need to stop using the former as well.
For comparable functionality, use the Cabability API: CAPABILITY_CHANGED in your manifest, and a CapabilityListener in your Java code. More details here: https://developer.android.com/training/wearables/data-layer/messages.html#SendMessage

How to avoid scan or filter a specific directory in Spring Integration?

With Spring integration, I would like to use my inbound channel adapter to scan a directory with a tree structure like this:
INDICATOR/
ref_1/
INPUTS/
ERRORS/
ref_2/
INPUTS/
ERRORS/
My root directory will be INDICATOR I would like to recursively scan all the directory and get all the files in, exept the ones in the ERRORS directory. In other words, how to deny or avoid scanning this specific directory?
is it possible to implements this class org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner and add a specific filter?
This is my actual config
<int-file:inbound-channel-adapter id="csvInputChannel"
directory="file:${directory.input}"
prevent-duplicates="false"
auto-startup="true"
auto-create-directory="false"
queue-size="1"
scanner="dirScanner">
<int:poller max-messages-per-poll="1" default="true" fixed-rate="1000" receive-timeout="5000" />
</int-file:inbound-channel-adapter>
<bean id="dirScanner"
class="org.springframework.integration.file.RecursiveLeafOnlyDirectoryScanner" />
Actually, I can only scan ALL the files present in ALL the directory recursively, I don' thave a clue how to add a filter.
Thanks in advance for any tips.
Actually I don't issues really to implement your own RecursiveLeafOnlyDirectoryScanner:
public class SkipErrorDirRecursiveLeafOnlyDirectoryScanner extends RecursiveLeafOnlyDirectoryScanner {
protected File[] listEligibleFiles(File directory) throws IllegalArgumentException {
if (!"ERRORS".equals(directorygetName())) {
return super.listEligibleFiles(directory);
}
}
}
I find a better way to do it, I just extend the DefaultDirectoryScanner and use this function
public class SkipErrorDirRecursive extends DefaultDirectoryScanner{
protected File[] listEligibleFiles(File directory) throws IllegalArgumentException {
File[] rootFiles = directory.listFiles();
List<File> files = new ArrayList<File>(rootFiles.length);
for (File rootFile : rootFiles) {
if (rootFile.isDirectory()) {
if (!"ERRORS".equals(rootFile.getName()))
files.addAll(Arrays.asList(listEligibleFiles(rootFile)));
}
else {
files.add(rootFile);
}
}
return files.toArray(new File[files.size()]);
}
}

OSGi Declarative Services - NullPointer Exception

I have a problem with my Declarative Services. I have 2 bundles, one is a server provider and another the user interface that consumes the service.
On server side, the implementation is:
public boolean checkUser(){
return true;
}
And the XML file inside OSGi-INF folder:
<component name="ZBService">
<implementation class="service.ZBService" />
<service>
<provide interface="service.IZBService" />
</service>
</component>
On client side, the implementation is:
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService{
IZBService zb;
public void setZBService(IZBService eventAdmin) {
this.zb = eventAdmin;
}
public void unsetZBService(IZBService eventAdmin){
if(this.zb == eventAdmin){
this.zb = null;}
}
public boolean greetServer(String input, String input2) throws Exception {
return zb.checkUser();
}
}
And XML file:
<component name="ZBService">
<implementation class="main.java.com.gwt.app.server.GreetingServiceImpl" />
<service>
<provide interface="main.java.com.gwt.app.client.GreetingService"/>
</service>
<reference name="zb" interface="service.IZBService" bind="setZBService" unbind="unsetZBService" cardinality="0..n" policy="dynamic" />
</component>
Also, I have included the tag Service-Component on manifest file and I have deployed the equinox ds bundle that is ACTIVE.
The client is a GWT user interface, then I inject the service reference into server side of GWT. Well, when I deploy the application on Equinox it runs, but when I push the button, I launch an event to call ZBService. I have debugged the application and the error is zb attribute is null. It is to say, the dependence is nos injected. However the services are exposed on Equinox. If I write services on Equinox console, the services are deployed. Then, my conclusion is the error is due to the injection does not perform.
I would like to know if someone knows what is the reason??
Thanks a lot in advance!!
Nice day
EDIT:
I did your suggestions but it doesn't run. I change the component names and condinality/policy. The result is the same --> NullPointerException due to the injection isn't done.
Also I have debug the application to see if the methods bind and/or unbind are called, but they aren't.
The complete class is:
public class GreetingServiceImpl extends RemoteServiceServlet implements GreetingService{
static protected IZBService zb;
public GreetingServiceImpl(){
System.out.println("Constructor GreetingServiceImpl");
}
public IZBService getZb() {
return zb;
}
public void setZb(IZBService zb) {
GreetingServiceImpl.zb = zb;
}
public void unsetZb(IZBService zb) {
GreetingServiceImpl.zb = zb;
}
#Override
protected void service(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException {
// Cache the current thread
Thread currentThread = Thread.currentThread();
// We are going to swap the class loader
ClassLoader oldContextClassLoader = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(this.getClass().getClassLoader());
super.service(req, resp);
currentThread.setContextClassLoader(oldContextClassLoader);
}
public void activate(ComponentContext context) {
System.out.println("Creating new greeter for " + context.getProperties().get("name")
+ ": " + context.getComponentInstance().toString());
}
public void activate() {
System.out.println("Activando la referencia al servicio");
}
public void deactivate(ComponentContext context) {
System.out.println("Deactivating greeter for " + context.getProperties().get("name")
+ ": " + context.getComponentInstance().toString());
}
public boolean greetServer(String input, String input2) throws Exception {
return zb.checkUser();
}
}
And the XML client is:
<?xml version="1.0" encoding="UTF-8" ?>
<scr:component name="serviceZB" xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0">
<implementation class="main.java.com.gwt.app.server.GreetingServiceImpl" />
<!-- <service>
<provide interface="main.java.com.gwt.app.client.GreetingService"/>
</service> -->
<reference name="zb" interface="service.IZBService"
bind="setZb" unbind="unsetZb" cardinality="1..1"
policy="static" />
</scr:component>
Why isn't the service injected if the service is deployed???
Here is a list of things you can try:
First, remove the "static" of zb, that could be the problem.
If you are using Equinox, add the -Dequinox.ds.print=true flag to the VM arguments and see more information about parsing XMLs and so
Of course, add sysouts to setZB and unsetZB :)
Remember that IZBService implementation needs a constructor without arguments
If you are using Equinox use the "list -c" command to obtain information of each component (it's cool because says exactly why a component is not registered).
Set the "inmediate=true" in XMLs to force to inmediatly activation.
You have both components with the same name, , which is kind of awkward when discussing them.
The reference on the client side has: cardinality="0..n" policy="dynamic". Which means it can be activated with zero to n references. Yet your code does not handle this. It seems to expect exactly one reference. Perhaps you should use cardinality="1..1" policy="static".

Setting apartment state for using WatIn with MSTest

I am getting the following error in:
The CurrentThread needs to have it's ApartmentState set to ApartmentState.STA to be able to automate Internet Explorer.
With the following code:
[TestClass]
public class UnitTest1
{
[AssemblyInitialize]
public static void AssemblySetup(TestContext context)
{
}
[TestMethod]
[HostType("ASP.NET")]
[AspNetDevelopmentServerHost("C:\\SomePath", "/")]
[UrlToTest("http://localhost/HomeView.aspx")]
public void TestMethod1()
{
using(IE ie = new IE("http://localhost/HomeView.aspx",true))
{
ie.TextField(Find.ById("MainContent_txtDLNumber")).TypeText("a235801945550");
}
}
}
Is there a different approach for using WatIn with MsTest?
You will probably need to adjust your config accordingly, below should give you a clue
<configuration>
<configSections>
<sectionGroup name="NUnit">
<section name="TestRunner" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<NUnit>
<TestRunner>
<!-- Valid values are STA,MTA. Others ignored. -->
<add key="ApartmentState" value="STA" />
</TestRunner>
</NUnit>
</configuration>
Consider updating your code to use NUnit 2.5 with RequiresSTA attribute.
Try this instead:
[STAThread]
static void Main(string[] args)
{
}

Resources