Phing PropertyTask - what is a fallback project scope? - phing

Update: This question is outdated. The fallback attribute can no longer found in the manual.
According to the Phing User Guide, PropertyTask provides a fallback attribute to specify a "fallback project scope" in case a reference cannot be found.
I tried to run this but it's obviously wrong:
<property name="test1" value="ok" />
<property name="test2" refid="nonExistentRef" fallback="test1" />
<echo>${test2}</echo>
Result:
Fatal error: Uncaught TypeError: Argument 1 passed to Reference::getReferencedObject() must be an instance of Project, string given, called in [...] classes/phing/tasks/system/PropertyTask.php on line 339 [...]
Can you provide me with a working usage example?

fallback expect a Project instance, and I think that it cannot be passed from build file.
Did you try with:
<property name="test1" value="ok" />
<property name="test2" refid="test1" />
<echo>${test2}</echo>
Output:
[echo] ok

Related

TFSMigrator Validate command giving custom type errors

We are using Data Migration tool to migrate devop server 2020 to devops service. During the validation process we got the error messages mentioned below.
There is no process mentioned against each projects in our collections. I believe we can’t set any process for our existing collection if one is not already there.
I have gone through the link mentioned below but it is talking about running feature wizard which is not available in Devop Server 2020.
Which process xml file i need to update?
https://learn.microsoft.com/en-us/azure/devops/migrate/migration-processtemplates?view=azure-devops#update-to-a-system-process
Here are the error messages;
Errors from the log file
Here are the version details;
Data Migration Tool Version: DataMigrationTool_AzureDevOps2020.1RTW_18.181.17017273
Devop Server Version: 18.181.31230.2 (Azure DevOps Server 2020 Update 1)
For error TF402574, you can edit the ProcessConfiguration.xml file to add the missing named TypeField element.
You can review ProcessConfiguration XML element reference for required TypeField elements.
For the example process specifies the following TypeField elements. If any of these are missing, you'll receive error TF402574.
<TypeFields>
<TypeField refname="System.AreaPath" type="Team" />
<TypeField refname="Microsoft.VSTS.Scheduling.RemainingWork" type="RemainingWork" format="format h" />
<TypeField refname="Microsoft.VSTS.Common.BacklogPriority" type="Order" />
<TypeField refname="Microsoft.VSTS.Scheduling.Effort" type="Effort" />
<TypeField refname="Microsoft.VSTS.Common.Activity" type="Activity" />
<TypeField refname="Microsoft.VSTS.Feedback.ApplicationStartInformation" type="ApplicationStartInformation" />
<TypeField refname="Microsoft.VSTS.Feedback.ApplicationLaunchInstructions" type="ApplicationLaunchInstructions" />
<TypeField refname="Microsoft.VSTS.Feedback.ApplicationType" type="ApplicationType">
<TypeFieldValues>
<TypeFieldValue value="Web application" type="WebApp" />
<TypeFieldValue value="Remote machine" type="RemoteMachine" />
<TypeFieldValue value="Client application" type="ClientApp" />
</TypeFieldValues>
</TypeField>
</TypeFields>

Alfresco Share: Retrieve config data from Java

I'd like to access share-config-custom.xml data from a Java bean in the Share webapp.
What is the equivalent to the following javascript syntax (which access the config root object) but in a Java context:
config.scoped['RepositoryLibrary']['root-node']
Is the share-config-custom translated to a bean itself? Or is there an API to read it from Java?
First, there is no "reasonable" way to use this API "looking" at one XML config file. In gen eral, the ConfigService creates a configuration merging from various sources. But looking directly at the XML should not be needed anyways.
That being said, the Javascript object config actually is a org.springframework.extensions.webscripts.ScriptConfigModel.
To get something equivalent in Java get yourself a reference to the ConfigService. To obtain the reference, let spring inject it in your custom bean:
<property name="configService" ref="web.config" />
Calling configService.getGlobalConfig() should get you the equivalent of config.scoped.
I know this is already answered, but Andreas' answer only got me halfway there. The configuration class is actually the XMLConfigService now.
Here's a code snippet that worked with Enterprise 4.1.* Alfresco:
Java class
import org.springframework.extensions.config.xml.XMLConfigService;
public class PDFValidate extends BaseJavaDelegate implements ExecutionListener
{
protected XMLConfigService configService;
public void setConfigService( XMLConfigService scriptConfigModel )
{
this.configService = scriptConfigModel;
}
Bean registration:
<bean id="AbstractWorkflowDelegate" parent="baseJavaDelegate" abstract="true" depends-on="activitiBeanRegistry" />
<bean id="PDFValidate" parent="AbstractWorkflowDelegate" class="com.epnet.alfresco.metadata.listener.PDFValidate">
<property name="repository" ref="repositoryHelper" />
<property name="configService" ref="web.config" />
</bean>
And from there, you can use the configService in your java code to get the config values.
The XMLConfigService is located in the spring-surf-core-configservice-1.2.0-SNAPSHOT.jar for my version of Alfresco.

Report job scheduling with custom data-source in jasper server 4.5.0

I am using Jasperserver 4.5.0 Pro. I have developed a custom data-source for some additional feature. All reports that use this custom DS get executed properly and show the correct output when executed manually. But when the same reports are scheduled using Jasper's report job scheduler, there is some problem with session initiation, and hence the reports do not get executed.
Let me explain this a bit.
For manual execution of reports -
As part of custom DS, I had to update the following 2 xmls -
viewReportFlow.xml :
I updated the action state 'runReport' to use our custom DS executer action bean method 'xmlHttpDsExecuterAction.setUpSession' to start session. Please see the below tag of runReport -
<action-state id="runReport" xmlns:b="http://www.springframework.org/schema/webflow" xmlns:xi="http://www.w3.org/2001/XInclude">
<on-entry>
<evaluate expression="xmlHttpDsExecuterAction.setUpSession"/>
</on-entry>
<evaluate expression="viewReportActionBean"/>
<transition on="success" to="reportOutput"/>
<on-exit>
<evaluate expression="xmlHttpDsExecuterPageAction.setIndex"/>
</on-exit>
viewReportBeans.xml :
I defined the executer action beans used in above flow xml here -
<bean id="xmlHttpDsExecuterAction" class="com.sigma.reporting.xmlhttpds.XmlHttpDsExecuterAction" xmlns:xsi="http://www.w 3.org/2001/XMLSchema-instance"/> <bean id="xmlHttpDsExecuterPageAction" class="com.sigma.reporting.xmlhttpds.XmlHttpDsExecuterPageAction" xmlns:xsi="http://www.w 3.org/2001/XMLSchema-instance">
<property name="requestParameterPageIndex" value="pageIndex"/>
<property name="flowAttributePageIndex" value="pageIndex"/>
<property name="xmlHttpDataSourceName" value="com.sigma.reporting.xmlhttpds.XmlHttpDsExecuterDataSourceService"/>
<property name="repository">
<ref bean="repositoryService"/>
</property>
<property name="jasperPrintName" value="jasperPrintName"/>
<property name="reportUnitObject" value="reportUnitObject"/> </bean>
For job scheduling of reports :
I want to implement similarly as above using scheduler. During my investigations, I have tried to analyze the scheduler flow, and tried to put our changes, but no luck so far. Can any one please let me know what flows are used for running reports via scheduler and also please recommend the places to configure custom DS as above?
Finally after understanding the flow of japser server scheduler i have got the solution for this.
For setting your custom data source beans and calling the function,we need to specify the bean destination in $JASPER_HOME/apache-tomcat/weaaps/jasperserver-pro/WEBINF/flows/reportJobBeans.xml and we can use this bean in reportJobFlow.xml in jobOutput tag lik this
<view-state id="jobOutput" view="modules/reportScheduling/jobOutput">
<on-entry>
<set name="flowScope.prevForm" value="'jobOutput'"/>
<evaluate expression="reportOptionsJobEditAction.setOutputReferenceData"/>
<evaluate expression="xmlHttpDsExecuterAction.setUpSession"/>
</on-entry>
</view-state>

Order of execution of RequestHandlers configured in Apache CXF and JAX-RS

I am in process of implementing a REST API server using Apache CXF JAX-RS v(2.30). I am using spring as container. I am thinking of making use of org.apache.cxf.jaxrs.ext.RequestHandler to implement few features like license check, authentication, authorization (All of which has custom code). My idea is to segregate this code in individual implementation classes (implementing RequestHandler) and configure it for a base REST url something like /rest/*. Being new to Apache CXF and JAX-RS, I want to understand following things.
Is this approach the right way to implement the features I want to?
If yes, then is the order in which the RequestHandlers are declared is the order of their invocation?
For example if in my definition I declare:
<beans>
<jaxrs:server id="abcRestService" address="/rest">
<jaxrs:serviceBeans>
<bean class="com.abc.api.rest.service.FooService" />
</jaxrs:serviceBeans>
<jaxrs:providers>
<ref bean="licenseFilter" />
<ref bean="authorizationFilter" />
</jaxrs:providers>
</jaxrs:server>
<bean id="licenseFilter" class="com.abc.api.rest.providers.LicenseValidator">
<!-- License check bean properties -->
</bean>
<bean id="authorizationFilter" class="com.abc.api.rest.providers.AuthorizationFilter">
<!-- authorization bean properties -->
</bean>
</beans>
then will the licenseFilter always get invoked before authorizationFilter?
I did not find a mention of invocation ordering of RequestHandlers as well as ResponseHandlers.
Thanks in advance.
Figured this out.
It gets invoked in the order of declaration of beans in <jaxrs:providers>. Thus in case mentioned in question, licenseFilter will get invoked before authorizationFilter.

403 error while deploying with tomcat client deployer

I have some trouble using Tomcat Client Deployer (TCD) with a local Tomcat installation. Specifically, I get a 403 error while trying to deploy a simple helloworld web application which leads me to the conclusion that something is not quite right with my tomcat-users.xml.
I just cannot see what it is.
here's the relevant build.xml snippet:
<!-- Configure the folder and context path for this application -->
<property name="webapp" value="helloworld"/>
<property name="path" value="/helloworld"/>
<!-- Configure properties to access the Manager application -->
<property name="url" value="http://localhost:8080/manager/text"/>
<property name="username" value="deploymgr"/>
<property name="password" value="s3cret"/>
tomcat-users.xml:
</tomcat-users>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<role rolename="tomcat"/>
<user username="deploymgr" password="s3cret" roles="manager-script"/>
<user username="tomcat" password="tomcat" roles="tomcat, manager-gui, manager-jmx, manager-status"/>
</tomcat-users>
deployer.properties:
build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager
username=deploymgr
password=s3cret
and when I try to deploy the application, I get the following error message:
D:\apache-tomcat-7.0.16-deployer>ant deploy
Buildfile: D:\apache-tomcat-7.0.16-deployer\build.xml
Trying to override old definition of datatype resources
deploy:
[echo] name: deploymgr, pass: s3cret, url: http://localhost:8080/manager
BUILD FAILED
D:\apache-tomcat-7.0.16-deployer\build.xml:92: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fhelloworld&update=true
only thing I find weird is that the error message URL contains a "%2F" instead of a forward slash... could it be that the user configuration is actually correct, I get the 403 simply because of the URL escape code? (I'm working under Windows Vista)
Can someone help me out on this? Oh, and of course the application deploys flawlessly through the user interface :-1
Thanks very much in advance.
perhaps an update on this issue... I've made a mistake in the deployer.properties file. The parameter "url" has to be the same as in build.xml above.
deployer.properties correctly:
build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager/text
username=deploymgr
password=s3cret
now it works!