Automatic JDBC Realm configuration - glassfish

I want to know if it's possible to create JDBC Realm configuration in Glassfish 3.1 without admin console, like creation of a Data Source with the glassfish-resources.xml.
When developers download my GIT repository they don't like to configure Glassfish, it's configured in deployment time.
Best regards
Mounir

I'd create a shell script or batch file which runs the required asadmin commands.
Here you can find a complete example: Creating JDBC Objects Using asadmin
(Btw, DTD of GlassFish Resources Descriptor does not contain any realm-related tag (include create-auth-realm).)

Related

spring cloud config server with multiple property sources

I have spring cloud config server reading properties from multiple sources (Git and Vault). For a given path, even it finds the resource in Git, it still queries vault and report failure as the resources are not available at both sources. My requirement is to look for a resource and if its found, no need to query the other source. Please suggest if its possible. Thanks

Glassfish workaround to work with OpenAM

The IT dept. in the company where I work uses OpenAM to manage web access over the intranet (SSO solution).
As I'm using Glassfish 4.1, which is a container not supported by OpenAM, is there some workaround that I could use OpenAM, without replacing Glassfish? If so, how can I do it?
Thanks in advance.
When using OpenAM 13.5.0 for example, it is possible to deploy OpenAM to Payara 4.1.2.172 for example with a bit of a compromise.
DISCLAIMER: the following steps allows one to deploy OpenAM to GlassFish/Payara, but this does not mean that this kind of deployment is actually supported by anyone.
So the steps are:
in the WAR file within the WEB-INF/lib/openam-radius-server-13.5.0.jar you'll need to remove the META-INF/INDEX.LIST file
you'll need to edit the WEB-INF/web.xml file and remove both the ws and federationrest servlets and their mappings
to deploy the WAR you'll need to execute this command:
bin/asadmin deploy --name openam --contextroot /openam --property implicitCdiEnabled=false OpenAM-13.5.0.war
It seems that OpenAM cannot be deployed on Payara (Glassfish). Please refer to the blog and the last comment of this issue.
So you may have to use another container, for example, Tomcat.

Writing a file using a different account in Spring Integration

Using Spring Integration file:outbound-channel-adapter, is there a way to specify what user account to use when writing the file. We need to write files from one domain to another. We would like to be able to write them just using file shares, but to do this, we need to be able to log in to the remote box with an account in the remote domain.
We can get around this with FTP, but would like to use file writing.
Thanks
I assume you are talking about windows domains/shares.
There are SMB adapters in the Spring Integration Extensions repository.
It includes a sample configuration file.
You can build it from github or there's a snapshot in the spring snapshot repo.

Getting configuration strings from Weblogic

This question is related to Weblogic 12c.
I have an EAR file that I want to deploy in various environments (dev, QA, pre-prod and prod). However, my application requires a username and a password (to connect to another server) and they're not the same across the four environments. I don't want to package 4 different property files in 4 different EAR files. I want a single generic EAR file. Beside, I don't want to handle the prod password during packaging.
Ideally, I'd like the admin of each environment to provide the appropriate username nad password for the environment. Unlike Tomcat, Jetty or JBoss(?), I think it's not possible for a WebLogic Admin to specify this information in a way that it will become available under the java:comp/env JNDI context.
How can an application obtain some admin-defined configuration strings from Weblogic?
BTW, it's not a username/password for a JDBC connection.
From what I understand, you need to change parameters based on the environment you are using right?
If you would like to override parameterss on the fly you can use WebLogic deployment plan concept.
Did you mean that you need to provide username/password to start-up the application?
If so, you may accomplish that by creating a script with WLST http://docs.oracle.com/cd/E15051_01/wls/docs103/config_scripting/using_WLST.html
As far as I know, the WebLogic way is to
Define your username/password as env-entry in the deployment descriptor
Deploy your application together with the plan.mxl whereas each environment admin maintains his own envrionemnt-specific version of the plan.xml
That way you get them into /comp/env/config
More details here: http://docs.oracle.com/cd/E11035_01/wls100/deployment/config.html
Only drawback known to me: plan.xml will always contain the unencrypted password but as the admin knows the password anyway and this is "his" file on "his" maschine that should be fine.

Should I use an FTP server as a maven host?

I would like to host a Maven repository for a framework we're working on and its dependencies. Can I just deploy my artifacts to my FTP host using mvn deploy, or should I manually deploy and/or setup some things before being able to deploy artifacts? I only have FTP access to server I want to host the Maven repo on.
The online repository I want to use is not hosted by myself. As I say, I only have FTP access, so if possible, I would like to use that FTP space as a Maven repository. The tools mentioned seem to work when you have full control over the host machine, or at least more than just FTP access since you need to configure the local directories where the repositories will be placed. Is this possible?
You might want to have a look at Nexus, a Maven repository manager. We've replaced our local Maven repository with a Nexus-based one and find it tremendously useful.
I've successfully used Archiva as my repository for several years ... see http://archiva.apache.org/. It's easy to administer and allows you to configure as many repositories as you need (SNAPSHOT, internal, external, etc).
According to the book "Better Builds with Maven", the most common type of repository is HTTP, this paragraph describes what I think you need:
This chapter will assume the repositories are running from http://localhost:8081/ and that artifacts are deployed to the repositories using the file system. However, it is possible to use a repository on another server with any combination of supported protocols including http, ftp, scp, sftp and more. For more information, refer to Chapter 3.
A Maven 2 repository is simply a specific directory structure, so once you get the transport and server specifications right for the repository and deployment portion of your POMs, it should be completely transparent to your users.
You can even use Dropbox. All that you need is a public address to access the files generated with mvn deploy, with any of the protocols in the accepted answer.
I guess there are more services that can work in the same way, but I'm not certain about the URL schemes that alternatives to Dropbox may use.
https://maven.apache.org/wagon/wagon-providers/wagon-ftp/ will tell you that you can use ftp to read from an existing repository, but not to create a new one. I don't think that it is impossible in principle, but no one has cared to write all the fiddly code to do the directory management via ftp.