Most of them facing little bit difficulty while doing project setup. Because, We must to do DB connecting process, Datasource creation, schedule tasks creation process if we put setup for running project and so on. For this, we need to use project based application servers (
CF or Lucee ) user interface. But, Most of them don't like this. They are expecting above mentioned process via code. Ofcourse,
cfschedule tag to create/update/run/delete schedule task files. But, we don't have an any other option to modify application server configurations via code.
Lucee administrator API solved this problem.
Lucee administrator API provides lot of opportunity to manipulate the Lucee administrator configurations without using lucee user interface, that can able to acheived by
cfadmin tag. This tag is fully integrated with
CFML and has lot of attributes to achieve our needs.
Here, We will explain, how to use
cfadmin tag and will explain some of the attributes useages.
|action||The administrative |
|type||The admin context: |
|password||The admin |
Usaullay, for creating/updating
datasource we need to login with
Lucee admin and then go to
datasource section. But,
cfadmin tag has the facility to create/update/remove
datasource without using
lucee admin user interface. Using below mentioned attributes we can able to acheieve our process.
We need use same attributes for creating/updating
datasources, but the small difference is, if the given
datasource name is not available in
lucee admin means, it will create new
|dbdriver|| Need to mention |
MSSQL - MSSQL MySQL - MySQL
|className|| Defines the name of the |
MSSQL - com.microsoft.sqlserver.jdbc.SQLServerDriver MySQL - com.mysql.cj.jdbc.Driver
|dsn||Defines the |
|name||Defines the |
|host||Contains the host of a database server in a data source definition|
|port||SQL server |
|dbusername||SQL server |
|dbpassword||SQL server |
|remoteClients||Every tag can contain remote clients to synchronize its settings with. It is a list of labels of in the admin defined remote clients|
Using the above mentioned sample code, we can able to create/update
lucee administrator. Here, I have mentioned DSN name
dsn and new DSN name
newdsn. So, the code first check
dsn name is available or not. If it's available means, just do the update. If it's not available, just create a new
cfadmin tag has the facility to list out all mentioned datasource details. Using the below mentioned code we can able to list out all the datasource info.
Not only create/update/remove
cfadmin tag, we can able to manipulate
Lucee server configurations also. Such as update lucee admin password, get version details, update versions, get Extension info and install new extension and so on.
|action||value - |
|type||Value - |
|provider||url of the extension provider|
Now, we don't need to restart the
lucee server manually. Instead of this, using below code can able to
restart the server
You are all know, The
Lucee server don't have all
extensions by default. Instead of, they are create new section to install the extension whatever we need for our applications. Actaully, this is good.
So, we can able to install/update the extension using
|type||web or server|
|password||Lucee admin password|