How to create my own custom version of Jaxb2RootElementHttpMessageConverter; so I can give it my own defined JAXB2 Marshaller via the application context xml configuration file?
Thanks,
Tonté
Just create a sub-class of the Jaxb2RootElementHttpMessageConverter.java and then override the necessary methods. Or you can complete create your own class by copying and pasting the source code of the Jaxb2RootElementHttpMessageConverter.java and then update class as necessary.
Related
I am adding file as a attribute in flow and state in corda.It accept it but while making transaction it shows error."exception: Class "class java.io.File" is not on the whitelist or annotated with #CordaSerializable." like this.i add cordaSerialization annotation and implement Serializationwhitelist interface also.After deploying I got same error. Is it possible to add file as a attribute in flow and state in corda ??
If you are looking to use external methods by adding that code file to your code, you would need to add the annotation #CordaSerializable to the file. More details at https://docs.corda.net/docs/corda-os/4.5/serialization.html#whitelisting
But it looks like you are trying to use the IO methods to attach the file to your corDapp. If that is the case, you need to upload your file to your node. You can learn about how to upload the file by this sample: https://github.com/corda/samples-java/tree/master/Features/attachment-sendfile
or https://github.com/corda/samples-java/tree/master/Features/attachment-blacklist
(They are two way to do it.)
Here is the context :
Each user of my application belongs to a company.
Parameters for each company are defined inside "company.yml" configuration files, all of them sharing the exact same structure.
These parameters are then used to tweak the application behavior.
It may sound trivial, but all I'm looking for is the proper way to load these specific YAML files.
From what I understood so far, using an Extension class isn't possible, since it has no knowledge about current user.
Using a custom service to manage these configurations rather than relying on Symfony's parameters seems more appropriate, but I can't find how to implement validation (using a Configuration class) and caching.
Any help would be greatly appreciated, thanks for your inputs!
Using the Yaml, Processor and Configuration components of Symfony2 should fit your needs.
http://symfony.com/doc/current/components/yaml/introduction.html
http://symfony.com/doc/current/components/config/definition.html
Define your "CompanyConfiguration" class as if you were in the DependencyInjection case
Create a new "CompanyLoader" service
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\Config\Definition\Processor;
$companies = Yaml::parse('company.yml');
$processor = new Processor();
$configuration = new CompanyConfiguration();
$processor->processConfiguration($configuration, $companies);
Now you should be able to use your companies array to do what you want
Have a look at http://symfony.com/doc/current/cookbook/configuration/configuration_organization.html as well as http://symfony.com/doc/current/cookbook/configuration/environments.html. If that's not the correct answer you'll have to be more specific on what your company.yml configuration contains.
I'm using Alfresco 5. I have create a custom type (parent type is cm:folder) and
added an entry for this type in the Document Library "Create" menu.
I would like to override the default folder create function so that I can do
some custom processing.
I would like to create some content within the new folder each time.
You can use alfresco behaviour/policies for your requirement.
For creating policy you need to create below things.
1.Spring Bean in context file
2.One class which implements onCreateNode from org.alfresco.repo.node.NodeServicePolicies
For more information regarding policies read below blog written by Jeff Potts
http://ecmarchitect.com/alfresco-developer-series-tutorials/behaviors/tutorial/tutorial.html
Apart from behaviour/policies easier option would be using rule and script.
You can create a rule which will be executed on creation of new
folder.
Create alfresco java script which will do processing you required on creation of
new folder.
Hook up script with rule.
I have followed this tutorial to create a send email custom action using Java backed Webscript:
http://ecmstuff.blogspot.com/2012/04/adding-document-library-actions-in.html?showComment=1403279845779#c303784066266925848
As has been mentioned above, there is an AbstractWebScript class defined just to execute the action without using a freemaker template, but I get this error:
Cannot locate template processor for template sendDocInEmail.get.html
I guess, there is a problem with the -context.xml file
My files are placed in the following folders:
1. the java .class files are in \tomcat\webapps\alfresco\WEB-INF\classes (placed with the package structure)
2. sendDocInEmail.get.desc in \tomcat\shared\classes\alfresco\extension\templates\webscripts folder (with the package structure)
3. services-context.xml file in the folder \tomcat\webapps\alfresco\WEB-INF\classes\alfresco\module (again with the package structure)
Please help!
Thanks in advance.
You most likely derived your class from DeclarativeWebScript which extends AbstractWebScript and adds the template processing. Make sure to derive your class from the latter.
I am new to the structure map but i want to use it in my asp.net site for dependency injection
can any one suggest me simple example to use structure map for the dependency injection
you will need to do something like this:-
StructureMapConfiguration
.ForRequestedType<IResourceA>()
.TheDefaultIsConcreteType<ResourceB>()
.CacheBy(InstanceScope.Singleton);
This tells StructureMap to inject ResourceB when there is a request for ResourceA.
Structure Map
You can configure programatically or via configuration file.
Programatical example (there are other ways):
StructureMap.StructureMapConfiguration.ForRequestedType<ISomething>().TheDefaultIsConcreteType<ConcreteSomething>();
then you can get an instance of the configured type using this sort of code:
//The concrete type will be ConcreteSomething
ISomething instance = ObjectFactory.GetInstance<ISomething>();
You can do it in a config file:
<StructureMap MementoStyle="Attribute">
<DefaultInstance PluginType="Blah.ISomething, Blah.SomethingDLL" PluggedType="Blah.Concrete.ConcreteSomething,Blah.ConcreteDLL"/>
</StructureMap>
and in the main method or Global.asax you can set this config by saying:
StructureMap.ObjectFactory.Initialize(x => { x.PullConfigurationFromAppConfig = true; });
and use it the same way as above:
ISomething instance = ObjectFactory.GetInstance<ISomething>();
If the concrete class has a constructor that needs instances injected in it, and you have those configured, the concrete types will get injected by the framework.
There are ways of passing parameters to constructors, dealing with Gereric types, creating named instances that are configured with specific constructor/property values. I use this framework and like it very much.