StringManager.getManager() usage - glassfish

I need help with the usage of com.sun.enterprise.util.i18n.StringManager (common-util.jar version 3.x). I haven't found how can I use the method
getManager(String packageName, ClassLoader classLoader)
what I don't how to instance the ClassLoader object to use the method (the older version of this method only had the String argument)
thanks in advance

Either you do
StringManager.getManager(getClass().getPackage().getName(), getClass().getClassLoader());
or you load your bundle directly
StringManager.getManager(ResourceBundle.getBundle("bundle.properties"));

Related

Notifying an instance as down using a ServiceCache in Curator

The documentation for Curator (http://curator.apache.org/curator-x-discovery/index.html) says:
If a particular instance has an I/O error, etc. you should call ServiceProvider.noteError() passing in the instance.
I am using a ServiceCache to get my instances, rather than a ServiceProvider (see Using selection strategies with a cache in Curator).
Where can I find the noteError() method here? I can't find it on the cache object
There is no noteError() on a ServiceCache, however as #Randgalt notes (https://stackoverflow.com/a/57059811/2048051) the best way is to not use a ServiceCache but rather just use ServiceProvider, because in the background that uses a cache anyway, and it has the noteError() method available.
https://issues.apache.org/jira/browse/CURATOR-531 has been raised to make the documentation clearer

Setting SessionProperty exception

I have various mule unit tests that extend my ABCTestTransformer - this creates a new instance of ABCTransformer but also extends the AbstractTransformerTestCase
On the tests when they create a new instance of ABCTransformer and get to this line within the transformer in the public Object transformMessage(MuleMessage message, String outputEncoding) method is where all the tests fail
message.setSessionProperty(data here)
I keep getting the following exception
failed with
exception(s)[org.mule.api.transformer.TransformerException: Detected
an attempt to set a invocation or session property, but a MuleEvent
hasn't been created using this message yet.
These unit tests were working with Mule 3.2 but I am migrating to 3.6 and I am now having issues.
Anyone able to shed any light on this?
Thanks
I think the setSessionProperty is already deprecated.
You may try this as an alternative.
message.setProperty(yourkey, value, PropertyScope.SESSION);
Hope this helps :)
As I understand it, you are setting the value on a wrong sequence, you should call the testEvent first before setting the values. Below is the screenshot, with setting a session variable that works, this is created with lower version of Munit and mule 3.4.
HTH

atlassian-plugin.xml contains a definition of component-import. This is not allowed when Atlassian-Plugin-Key is set

This is what I get when I run atlas-create-jira-plugin followed by atlas-create-jira-plugin-module selecting option 1: Component Import.
The problem is that all tutorial examples appear to have plugin descriptor generated by old SDK version (that won't deploy with newer versions of SDK/Jira at all), which do not feature Atlassian-Plugin-Key, so I can't find my way to import a component.
I'm using SDK 6.2.3 and Jira 7.1.1.
Any hint - how to get this sorted out?
anonymous is correct. The old way of doing things was to to put the <component-import> tag in your atlassian-plugin.xml. The new way and also recommended is to use Atlassian Spring Scanner. When you create your add-on using atlas-jira-create-plugin and your pom.xml has the <Atlassian-Plugin-Key> tag and the dependencies atlassian-spring-scanner-annotation and atlassian-spring-scanner-runtime then you are using the new way.
If you have both the dependencies, you are using Atlassian Spring Scanner version 1.x. If you only have atlassian-spring-scanner-annotation then you are using version 2.x.
You don't have to omit/comment out Atlassian-Plugin-Key in your pom.xml and you don't have to put component-import in your atlassian-plugin.xml.
For example, you want to add licensing for your add-on and need to import the component PluginLicenseManager. You just go straight to the code and your constructor might look like this:
#Autowired
public MyMacro(#ComponentImport PluginLicenseManager licenseManager) {
this.licenseManager = licenseManager;
}
And your class like this:
#Scanned
public class MyMacro implements Macro {
If memory serves me right, be sure to check for null because sometimes Atlassian Spring Scanner can't inject a component. I think on version 1, writing an #EventListener, it could not inject a ConversionContext. But when writing a Macro, it was able to inject a ConversionContext.
According to
https://bitbucket.org/atlassian/atlassian-spring-scanner
component-import is not needed. You can replace it by #ComponentImport annotation in your Java.
Found answer here: https://developer.atlassian.com/docs/advanced-topics/configuration-of-instructions-in-atlassian-plugins
It looks like I've somehow been missing that Atlassian-Plugin-Key can be omitted, and it must be done when you need to import components.
This key just tells spring not to 'transform' plugin's Spring configuration, which must happen as part of components import process..

aurelia.globalizeResources no longer available

Is aurelia.globalizeResourcesno longer available during main configuration stage? What is alternative way to register global resources in aurelia?
The method has been renamed to globalResources:
globalResources(resources: string | string[]): FrameworkConfiguration;

set() is deprecated since version 2.1 Access the public property 'vars' instead

I have been looking for other users with this symfony 2.1.8 to 2.2.0 upgrade depreciation warning:
set() is deprecated since version 2.1 Access the public property 'vars' instead
I have not been able to find anything in the official documentation, or on the internet at the moment.
Is anyone able to give an example using the public property variables?
According to the message, the variable you want to add information is public, so you don't need to use set() function to add value.
Instead of :
$object->set('name', 'value');
Simply use:
$object->vars['name'] = 'value';