JOSSO's <ignore-url-patterns> example needed - josso

Just wondering if anyone could show me an example of how the works with JOSSO's partner-app in joss-agent-config.xml?

Just solved this today. To set URL patterns for the JOSSO ignore-url-patterns tag you need to use a tag from another namespace:
<agent:partner-app context="/" id="Liferay">
<agent:ignore-url-patterns>
<s:value>*.css</s:value>
<s:value>*.js</s:value>
<s:value>*.gif</s:value>
<s:value>*.jpg</s:value>
<s:value>*.png</s:value>
</agent:ignore-url-patterns>
</agent:partner-app>
This assumes that you have xmlns:agent="urn:org:josso:agent:core" and xmlns:s="http://www.springframework.org/schema/beans".
The XSD for the ignore-url-patterns uses the "##other" scope so it must be a tag from another namespace. I've used spring's <value /> tag because it is a simple container for a string and will work great for holding the various url patterns that you want to use.

<configuration>
<agent:agent-configuration>
<!-- ============================================================================= -->
<!-- -->
<!-- JOSSO Parnter application definicions : -->
<!-- -->
<!-- Configure all web applications that should be a josso partner application -->
<!-- within this server. -->
<!-- For each partner application you have to define the proper web-context. -->
<!-- ============================================================================= -->
<agent:partner-apps>
<agent:partner-app id="AdminApp" context="/admin"/>
<agent:partner-app id="HOME" context="/home" >
<ignore-web-resource-collections>public-resources,img-resources</ignore-web-resource-collections>
</agent:partner-app>
<agent:partner-app id="EmployeeApp" context="/emp"/>
<agent:partner-app id="AuditApp" context="/audit"/>
</agent:partner-apps>
</agent:agent-configuration>

Related

Issue enabling jpa and jdbc in Websphere Liberty

I am following these exercises for learning Liberty.
I am having an issue in he Lab 3 - Module 2.2 Liberty and JPA (DB2) .
After setting all the JDBC and Data Source details, i restart the server and i do not see the two lines that mention the dataSource and jdbd driver.
[AUDIT] J2CA8004I : The dataSource DB2Connection is avilable as jdbc/DB2Connection.
[AUDIT] J2CA8000I : The jdbcDriver my JDBCDriver is available.
How can i know if the jpa and jdb features ae correctly set?
This is the server.xml
<!-- Enable features -->
<featureManager onError="WARN">
<feature>jsp-2.2</feature>
<feature>jpa-2.0</feature>
<feature>jdbc-4.0</feature>
</featureManager>
<!-- To access this server from a remote client add a host attribute to the following element, e.g. host="*" -->
<httpEndpoint id="defaultHttpEndpoint"
httpPort="9080"
httpsPort="9443" />
<jdbcDriver id="myJDBCDriver">
<library name="DB2Lib">
<fileset dir="C:\wlp\db2jdbc" includes="db2jcc4.jar, db2jcc_license_cu.jar"></fileset>
</library>
</jdbcDriver>
<dataSource jndiName="jdbc/DB2Connection" id="DB2Connection"
jdbcDriverRef="myJDBCDriver">
<properties.db2.jcc databaseName="SAMPLE" serverName="igacloud" password="{xor}FhgeOz1tPj08" user="db2admin"></properties.db2.jcc>
</dataSource>
Unlike Classic WebSphere, which has a "test connection" capability in its admin console (datasource panel), there is no equivalent means with WebSphere Liberty yet. Have you tried testing the connection with a simple "Hello World" JPA application?
The CWWKF0012I message is simply confirming what features have been enabled - some features depend on other features and automatically enables them, which is why you see more features than defined in your server.xml.

PMD violationSuppressXPath for all REST #GET methods?

I am trying to narrow down the PMD rules, how can I exclude all REST methods which are annotated with #GET from PMD checks?
PMD provides several ways to suppress warnings: http://pmd.sourceforge.net/pmd-5.2.3/usage/suppressing.html
via Annotations: #SuppressWarnings("PMD.")
via Comments: //NOPMD ignore this
via Regex and XPath per Rules
You can also excluding complete files - see http://pmd.sourceforge.net/pmd-5.2.3/customizing/howtomakearuleset.html - Excluding files from a ruleset
For your case, violationSuppressXPath, this XPath expression should work:
./ancestor::ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation/Name[#Image='GET']
This will go up (ancestor) from the current node (which might be inside a method) to the method declaration ("ClassOrInterfaceBodyDeclaration") and goes down the tree from there to check for the #GET annotation. However, I don't know about the performance impact.
Update:
Complete example:
<rule ref="rulesets/java/optimizations.xml/MethodArgumentCouldBeFinal">
<properties>
<!-- Ignore Rest resources -->
<property name="violationSuppressXPath" value="
./ancestor::ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation/Name
[#Image='GET' or #Image='POST' or #Image='PUT' or #Image='DELETE']" />
</properties>
</rule>
We are using for example this rules to suppress checks on REST methods for final declaration. Maybe you need similar?
<rule ref="rulesets/java/optimizations.xml/MethodArgumentCouldBeFinal">
<properties>
<!-- Ignore Rest resources -->
<property name="violationSuppressXPath" value="
//ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[#Image='GET'] |
//ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[#Image='POST']|
//ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[#Image='PUT'] |
//ClassOrInterfaceBodyDeclaration/Annotation/MarkerAnnotation//Name[#Image='DELETE']" />
</properties>
</rule>

How to add the description of job in spring batch admin user interface?

Is there any way to add the description of job at the user interface of spring batch admin?
Although, I tried to added the description of the job, spring batch admin cannot support it.
I would like to know that whether spring batch admin does not support it or not.
I know i'm late to the party but I figured it out and it works flawlessly for me. All you have to do is :
Add a messages.properties file in your classpath (under
src/main/resources).
Add yourJobName.description=Your description goes here in that file.
Override manager-context.xml for SBA by creating a file on path src/main/resources/META-INF/spring/batch/servlet/override/manager-context.xml
The content of the above created file should be :
`
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
<!-- Override messageSource bean in order to provide custom text content -->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
</bean>
</beans>
`
That's it. Your custom description shows up in SBA. Hope this helps someone who's looking for it.
There isn't the ability out of the box to display the job's description. That is only contained in the XML and the data seen in the UI comes from the JobRepository. You'd have to extend the UI to add that functionality.

WSO2 Business Process bpel, error in gui with "if" component

I currently work on a simple business process with the wso2 Business Process Server in Eclipse Developer Studio. I have created a little bpel process with an “if” condition. I got it to work on the server without problems. But, I had to make my “if” condition in the source code, I was not able to configure the if component per gui. I always get the following error when I click on the “Details” tab of the “if” component:
An error has occurred. See error log for more details.
org.eclipse.ui.internal.EditorReference.<init>(Lorg/eclipse/ui/internal/EditorManager;Lorg/eclipse/ui/IEditorInput;Lorg/eclipse/ui/internal/registry/EditorDescriptor;)V
Does anyone know how to avoid this error? It would be great to configure the “if” condition per GUI for demonstrations…
I'am using Developer Studio 3.2.0
Here is my bpel source code:
<!-- Befunde BPEL Process [Generated by the Eclipse BPEL Designer] -->
<!-- Date: Mon Mar 05 12:13:11 IST 2012 -->
<bpel:process name="Befunde"
targetNamespace="http://avintis.com/befunde"
suppressJoinFailure="yes"
xmlns:tns="http://avintis.com/befunde"
xmlns:bpel="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
xmlns:ns1="urn:hl7-org:v2xml"
xmlns:hl7="http://wso2.org/hl7"
xmlns:ns="http://ws.apache.org/axis2">
<!-- Import the client WSDL -->
<bpel:import location="BefundeArtifacts.wsdl" namespace="http://avintis.com/befunde" importType="http://schemas.xmlsoap.org/wsdl/" />
<!-- ================================================================= -->
<!-- PARTNERLINKS -->
<!-- List of services participating in this BPEL process -->
<!-- ================================================================= -->
<bpel:partnerLinks>
<!-- The 'client' role represents the requester of this service. -->
<bpel:partnerLink name="client"
partnerLinkType="tns:Befunde"
myRole="BefundeProvider"
/>
</bpel:partnerLinks>
<!-- ================================================================= -->
<!-- VARIABLES -->
<!-- List of messages and XML documents used within this BPEL process -->
<!-- ================================================================= -->
<bpel:variables>
<!-- Reference to the message passed as input during initiation -->
<bpel:variable name="input"
messageType="tns:BefundeRequestMessage"/>
<!--
Reference to the message that will be returned to the requester
-->
<bpel:variable name="output"
messageType="tns:BefundeResponseMessage"/>
</bpel:variables>
<!-- ================================================================= -->
<!-- ORCHESTRATION LOGIC -->
<!-- Set of activities coordinating the flow of messages across the -->
<!-- services integrated within this business process -->
<!-- ================================================================= -->
<bpel:sequence name="main">
<!-- Receive input from requester.
Note: This maps to operation defined in Befunde.wsdl
-->
<bpel:receive name="receiveInput" partnerLink="client"
portType="tns:Befunde"
operation="process" variable="input"
createInstance="yes"/>
<!-- Generate reply to synchronous request -->
<bpel:assign validate="no" name="InputToResult">
<bpel:copy>
<bpel:from>
<bpel:literal>
<tns:BefundeResponse xmlns:hl7="http://wso2.org/hl7" xmlns:ns1="urn:hl7-org:v2xml" xmlns:tns="http://avintis.com/befunde" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><tns:result>tns:result</tns:result>
</tns:BefundeResponse>
</bpel:literal>
</bpel:from>
<bpel:to variable="output" part="payload"></bpel:to>
</bpel:copy>
<bpel:copy>
<bpel:from part="payload" variable="input">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[hl7:message/ns1:ORU_R01/ns1:ORU_R01.RESPONSE/ns1:ORU_R01.ORDER_OBSERVATION/ns1:ORU_R01.OBSERVATION/ns1:OBX/ns1:OBX.8]]>
</bpel:query>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0">
<![CDATA[tns:result]]>
</bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:if name="If_OBX8">
<bpel:condition>
<![CDATA[$output.payload/tns:result="HH"]]>
</bpel:condition>
<bpel:assign validate="no" name="Panic">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">Panic</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
<bpel:else>
<bpel:assign validate="no" name="Normal">
<bpel:copy>
<bpel:from>
<bpel:literal xml:space="preserve">Normal</bpel:literal>
</bpel:from>
<bpel:to part="payload" variable="output">
<bpel:query queryLanguage="urn:oasis:names:tc:wsbpel:2.0:sublang:xpath1.0"><![CDATA[tns:result]]></bpel:query>
</bpel:to>
</bpel:copy>
</bpel:assign>
</bpel:else>
</bpel:if>
<bpel:reply name="replyOutput"
partnerLink="client"
portType="tns:Befunde"
operation="process"
variable="output"
/>
</bpel:sequence>
</bpel:process>
It's a known issue as explained WSO2 developer studio edit properties of an assign activity
Please try out Developer Studio 3.0.0, that works!

GWT: how to write client side logs into a log file in GWT

HI guys i am facing a big problem to write logs in a file in GWT.
i ahd gone through all the posts over internet but i didn't find any valuable information
there.
What i did ...
added remote logging servlet in web.xml file
inherited the logging module in my .gwt.xml file.
But my question is here now suppose i have written one log in my Entry Point class.
like ....
//Main class to start the appliation.....
public void onModuleLoad() {
Logger logger=Logger.getLogger(SYTMain.class.getName());
logger.info("Test Log in Module File");
}
and now i want to write this client side log into a test.log file .
How i can achieve this???/
Please if anyone knows the answer then plz provide me the complete solution, i don't want example on a fly. if you really know then only plz tell me don't give the answer which is already available in net.....
mY delivery date is very near so plz update on same ASAP, i'll be very thankful to you.
In your module file add the following:
<inherits name='com.google.gwt.logging.Logging'/>
<set-property name="gwt.logging.enabled" value="TRUE"/>
<!-- Set logging level to INFO -->
<set-property name="gwt.logging.logLevel" value="INFO"/>
<set-property name="gwt.logging.simpleRemoteHandler" value="ENABLED" />
<!-- Add compiler.stackMode to get a readable stacktrace from JavaScript
It generates a set of files in WEB-INF/deploy; those files need to
be placed on the server
-->
<set-property name="compiler.stackMode" value="emulated" />
In your web.xml add the following:
<servlet>
<servlet-name>remoteLoggingService</servlet-name>
<servlet-class>com.google.gwt.logging.server.RemoteLoggingServiceImpl</servlet-class>
</servlet>
<!-- Servlet Mapping -->
<servlet-mapping>
<servlet-name>remoteLoggingService</servlet-name>
<url-pattern>/<your module name>/remote_logging</url-pattern>
</servlet-mapping>
Replace <your module name> with as it says your module name.
To log simply use the code as your mentions. Use the import from java.util.logging.
On the client side, GWT compiles to Javascript, and Javascript cannot in general write files to the client's filesystem. (It should be obvious why this could be a bad idea). See for example this discussion.
If what you need is logs to use for debugging, one obvious solution is to have the logger append to a text area on the page. You can always copy and past manually into another file. Or, if you want to debug remotely, you could have the logger write to the server.
Just create a RPC service to log it into the server-side.
Use the servlet-side threadlocal to get info about the client: ThreadLocal to store ServletRequest and Response in servlet: what for?.