creating Sites using java - java

i developed one application used to create google sites by referring the developer guide in which i don't know what are the three parameters in this is particular line
SitesService client = new SitesService("yourCo-yourAppName-v1").
This is my problem. help me

There is only one parameter in your example, it is the application name.
What you have in your example is an example of an application name composed from a company name (yourCo) a name for the application (yourAppName) and a version for your application (v1).
Does this help you ?

Related

How to connect to multiple datasources in Spring Boot, after the initialisation of the application context?

I want to initialize a data source in spring boot after the application context is initialized. There are several answers on the internet about how to setup multiple data sources, but each of them is done by somehow giving all the details in application properties before the application starts.
I found an article on baeldung about how to programmatically setup my data source, but this is not what I want.
https://www.baeldung.com/spring-boot-configure-data-source-programmatic
I will explain,
I am dealing with several databases, lets take as an example that I am the owner of several branches of a school. Lets call the schools - school1, school2, school3.... and so on till school100.
The datasource link for each school is somewhat like this
jdbc:postgres:schoolserver01:21000/school01
jdbc:postgres:schoolserver02:21000/school02
jdbc:postgres:schoolserver03:21000/school03
.
.
.
.
jdbc:postgres:schoolserver100:21000/school100
In simpler words, what I mean is that I can construct a string to match the data source URL based on some programming logic.
The problem that I am dealing with is, I don't want to give the data source URLs of all the schools in the application props, instead I want to initialize the data source as and when the requirement arises by building an instance of the datasource for the required school.
Please guide me if it is possible, if yes, then how?
Whatever you are trying to build is not practical and I doubt that you see a real world implementation on it. Spring boot when containerized should be disposable. One container should have only its dedicated database. I keep on writing more on this but it will help if you can read more on Microservice design.

Is it possible to create a custom form in Camunda BPM changing "on-the-fly" without re-deploy?

I'm new to Camunda and still trying to figure out what things are possible.
Camunda BPM provides at least three ways to create custom forms:
Web-based form using AngularJS https://github.com/camunda/camunda-bpm-examples/tree/master/sdk-js/browser-forms-angular
Web-based form using JSF https://github.com/camunda/camunda-bpm-examples/tree/master/bpmn-model-api/generate-jsf-form
Embedded task form using several mechanisms https://github.com/camunda/camunda-bpm-examples/tree/master/usertask
I suppose I can customize a form any of those ways, but I wonder if I can create "on-the-fly" customization based on a pre-defined template stored in a database.
For example, I have a process of handling customer requests. They usually want something from three categories: A, B, and C.
FormA, FormB, and FormC are different but having typical fields for those kinds of requests.
Is there any way to add FormD in Camunda without re-deploy and changing source code of the task/process?
I mean just add a template of FormD in the database and see changes on the next process start.
Best regards, Ivan
You can bundle process models and custom html template in a deployment and hot deploy it together. No server restart required.
You can do this via Cockpit (if EE) or REST API:
https://docs.camunda.org/manual/develop/reference/rest/deployment/
One possible way to do that is through custom form builder using external service form.io - https://forum.camunda.org/t/form-builder-drag-and-drop-form-server-validations/1092/14
Based on the answer from Camunda BPM forum: https://forum.camunda.org/t/is-it-possible-to-create-on-the-fly-changing-form/20683
So, theoretically it's achievable I assume.

Create Site in Alfresco using the Apache Chemistry

Greetings to the community! I am using alfresco Community Edition 6.0.0 with the Apache Chemistry API. I have successfully managed so far to create/fetch content from the alfresco repository through it (Folder and Document files).
Now what I would like to do is use the Apache Chemistry API to create an alfresco site (like I would do using the alfresco/api/-default-/public/alfresco/versions/1/sites POST method in the Alfresco REST API).
Is that feasible?? What I have done following the way I already created folders in the repository is:
Folder folder = retrieveSitesFolder(); // this returns the folder object using the node id of the "Sites" node
Map<String, Object> props = new HashMap<String, Object>();
props.put(PropertyIds.OBJECT_TYPE_ID, "F:st:site"); //this is recognized fine
props.put("st:siteVisibility", "PUBLIC");
props.put("st:sitePreset", "something");
props.put("cmis:name", "something");
Folder subFolder = folder.createFolder(props);
I am following the site model from here concerning the properties I add
https://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/COMMUNITYTAGS/V4.2a/root/projects/repository/config/alfresco/model/siteModel.xml
Unfortunately, when I run this piece of code I get the following error:
Exception in thread "main" org.apache.chemistry.opencmis.commons.exceptions.CmisRuntimeException: 10290059 Site something does not exist.
which seems to me very strange as what I expect my code to do is create that site not search for it in anyway.
What makes this more strange is when I created a site with name "something" via the REST API and re-run the code, the code run successfully, but I did not get any extra site in the alfresco/api/-default-/public/alfresco/versions/1/sites endpoint of the REST API.
Could anyone shed some light on this please? Any help would be greatly appreciated!
As Gagravarr says the API hasn't supported creating functional sites until, as Billerby pointed out, the REST API made some improvements.
Apache Chemistry has no idea what a site is, but, as you've discovered, an st:site is just a child type of cm:folder.
Despite that this is most likely not going to work via CMIS, I wanted to point out that you are using "something" for site preset. That is not going to work unless you've defined a new site preset called "something".
By default, there is a single out-of-the-box site preset called "site-dashboard" which is the ID for the "Collaboration Site" preset.
You might change your st:sitePreset to "site-dashboard" and see if you get any further.

Getting OpenStack Server's Tags

I'm using jclouds Java SDK, i search in the documentation and in the jclouds examples for how to get the tags of a Nova server, but i didn't find any mention of it. i found some other function to get the instance name, instance metadata and so on in the following code
NovaApi novaApi = computeServiceContext.unwrapApi(NovaApi.class);
String region = novaApi.getConfiguredRegions().iterator().next();
ServerApi serverApi = novaApi.getServerApi(region);
Server instance = serverApi.get(TEMP_SERVERNAME);
in the variable instance i can get information about the instance such as metadata for example, but not the tags.
my question is this OpenStack API implemented in the jclouds SDKs? if yes how can i call it?
Thanks
That API call is not yet implemented in the jclouds Server API. However, it should be pretty easy and straightforward to add that method. Would you be willing to contribute to the project and add it? I would be more than happy to help you get that done!

Share instance between Java App and Web App

I have some personal project where I am trying to share some class instance between webapp and a normal app. My project structure is something like below:
+ NormalApp
+ WebApp
I am starting the application from the NormalApp and I included WebApp using EmbeddedTomcat. Now I have a class named Notifier in WebApp. I want to use the instance of Notifier in NormalApp without losing it's state.
Could someone tell me how can I achieve this scenario?
I have some plan in mind like setting the Tomcat class loader to use Systems class loader. I tried it but couldn't able to achieve it. Is my understanding of this wrong?
Have you tried making your normal app like web components ? so your application will be available when tomcat start. And you can use System properties to pass parameters to the tomcat.
Another option is using Spring boot. Here is a tutorial
https://spring.io/guides/gs/spring-boot/
http://spring.io/guides/tutorials/bookmarks/

Categories