Skip to content

Commit

Permalink
add ORM configuration frondend to admin
Browse files Browse the repository at this point in the history
  • Loading branch information
micstriit committed Sep 24, 2010
1 parent 252704e commit a652874
Show file tree
Hide file tree
Showing 10 changed files with 197 additions and 108 deletions.
3 changes: 1 addition & 2 deletions railo-cfml/railo-admin/Component.cfc
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
<cfcomponent displayname="Component" hint="This is the Base Component">
</cfcomponent>
<cfcomponent displayname="Component" hint="This is the Base Component"></cfcomponent>
6 changes: 3 additions & 3 deletions railo-cfml/railo-admin/admin/resources/de/res_menu.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
struct(
action:"services",label:"Dienste",
children:array(
struct(action:"gateway",label:"Event Gateway (Alpha)"),
struct(action:"cache",label:"Cache (Beta)"),
struct(action:"gateway",label:"Event Gateway (Beta)"),
struct(action:"cache",label:"Cache"),
struct(action:"datasource",label:"Datenquellen"),
//struct(action:"gateway",label:"Gateway (Beta)"),
struct(action:"search",label:"Suche",hidden: request.adminType NEQ "web"),
//struct(action:"orm",label:"ORM (Alpha)"),
struct(action:"orm",label:"ORM (Beta)"),
struct(action:"mail",label:"Mail"),
struct(action:"tasks",label:"Tasks",xhidden: server.ColdFusion.ProductLevel eq "community" or server.ColdFusion.ProductLevel eq "professional"),
//struct(action:"video",label:"Video",hidden:server.ColdFusion.ProductLevel eq "community"),
Expand Down
6 changes: 3 additions & 3 deletions railo-cfml/railo-admin/admin/resources/en/res_menu.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@
struct(
action:"services",label:"Services",
children:array(
struct(action:"gateway",label:"Event Gateway (Alpha)"),
struct(action:"cache",label:"Cache (Beta)"),
struct(action:"gateway",label:"Event Gateway (Beta)"),
struct(action:"cache",label:"Cache"),
struct(action:"datasource",label:"Datasource"),
//struct(action:"gateway",label:"Gateway (Beta)"),
struct(action:"search",label:"Search",hidden: request.adminType NEQ "web"),
//struct(action:"orm",label:"ORM (Alpha)"),
struct(action:"orm",label:"ORM (Beta)"),
struct(action:"mail",label:"Mail"),
struct(action:"tasks",label:"Tasks",xhidden: server.ColdFusion.ProductLevel eq "community" or server.ColdFusion.ProductLevel eq "professional"),
//struct(action:"video",label:"Video",hidden: server.ColdFusion.ProductLevel eq "community"),
Expand Down
8 changes: 1 addition & 7 deletions railo-cfml/railo-admin/admin/services.cache.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,7 @@
password="#session["password"&request.adminType]#"
returnVariable="access"
secType="cache">
<span class="CheckError">
The Cache Implementation is currently in Beta State. Its functionality can change before it's final release.
For addional Cache Implementation (EHCache,MemCache,JBossCache) check the Extension/Application page.<br />
If you have any problems while using the Cache Implementation, please post the bugs and errors in our
<a href="https://jira.jboss.org/jira/browse/RAILO" target="_blank" class="CheckError">bugtracking system</a>.
<br /><br />
</span>

<cfswitch expression="#url.action2#">
<cfcase value="list"><cfinclude template="services.cache.list.cfm"/></cfcase>
<cfcase value="create"><cfinclude template="services.cache.create.cfm"/></cfcase>
Expand Down
5 changes: 2 additions & 3 deletions railo-cfml/railo-admin/admin/services.gateway.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,8 @@
</cfloop>

<span class="CheckError">
The Gateway Implementation is currently in Alpha State. Its functionality can change before it's final release.<br />
If you have any problems while using the Gateway Implementation, please post the bugs and errors in our
bugtracking system.
The Gateway Implementation is currently in Beta State. Its functionality can change before it's final release.
If you have any problems while using the Gateway Implementation, please post the bugs and errors in our <a href="https://jira.jboss.org/jira/browse/RAILO" target="_blank" class="CheckError">bugtracking system</a>.
</span>

<cfswitch expression="#url.action2#">
Expand Down
15 changes: 3 additions & 12 deletions railo-cfml/railo-admin/admin/services.orm.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,11 @@


<span class="CheckError">
The ORM Implementation is currently in Alpha State. Its functionality can change before it's final release.
If you have any problems while using the Gateway Implementation, please post the bugs and errors in our <a href="https://jira.jboss.org/jira/browse/RAILO" target="_blank" class="CheckError">bugtracking system</a>.
The ORM Implementation is currently in Beta State. Its functionality can change before it's final release.
If you have any problems while using the ORM Implementation, please post the bugs and errors in our <a href="https://jira.jboss.org/jira/browse/RAILO" target="_blank" class="CheckError">bugtracking system</a>.
<br /><br />
</span>


<cfinclude template="services.orm.list.cfm"/>


<cfswitch expression="#url.action2#">
<cfcase value="list"><cfinclude template="services.orm.list.cfm"/></cfcase>
<cfcase value="create"><cfinclude template="services.orm.create.cfm"/></cfcase>

</cfswitch>


<cfdump var="#settings#">
<cfdump var="#engine#">
147 changes: 71 additions & 76 deletions railo-cfml/railo-admin/admin/services.orm.list.cfm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,71 @@ If any value of savemapping is specified in CFC, it will override the value spec



<cfif request.adminType EQ "web">
<cfset resetLabel=stText.Buttons.resetServerAdmin>
<cfelse>
<cfset resetLabel=stText.Buttons.reset>
</cfif>

<cftry>
<cfset stVeritfyMessages = StructNew()>
<cfswitch expression="#form.mainAction#">
<!--- UPDATE --->
<cfcase value="#stText.Buttons.update#">

<cfadmin
action="updateORMSetting"
type="#request.adminType#"
password="#session["password"&request.adminType]#"

autogenmap="#structKeyExists(form,'autogenmap') and form.autogenmap#"
eventHandling="#structKeyExists(form,'eventHandling') and form.eventHandling#"
flushatrequestend="#structKeyExists(form,'flushatrequestend') and form.flushatrequestend#"
logSQL="#structKeyExists(form,'logSQL') and form.logSQL#"
savemapping="#structKeyExists(form,'savemapping') and form.savemapping#"
useDBForMapping="#structKeyExists(form,'useDBForMapping') and form.useDBForMapping#"

catalog="#form.catalog#"
cfclocation="#form.cfclocation#"
dbcreate="#form.dbcreate#"
schema="#form.schema#"


sqlscript="#settings.sqlscript#"
cacheconfig="#settings.cacheconfig#"
cacheProvider="#settings.cacheProvider#"
ormConfig="#settings.ormConfig#"
secondarycacheenabled="#settings.secondarycacheenabled#"


remoteClients="#request.getRemoteClients()#">
</cfcase>
<!--- RESET --->
<cfcase value="#resetLabel#">
ddd
<cfadmin
action="resetORMSetting"
type="#request.adminType#"
password="#session["password"&request.adminType]#"

remoteClients="#request.getRemoteClients()#">
</cfcase>

</cfswitch>
<cfcatch><cfrethrow>
<cfset error.message=cfcatch.message>
<cfset error.detail=cfcatch.Detail>
</cfcatch>
</cftry>
<!---
Redirtect to entry --->
<cfif cgi.request_method EQ "POST" and error.message EQ "" and form.mainAction neq stText.Buttons.verify>
<cflocation url="#request.self#?action=#url.action#" addtoken="no">
</cfif>





<cfoutput>
<h2>#stText.Settings.orm.title#</h2>
Expand Down Expand Up @@ -110,7 +175,7 @@ If any value of savemapping is specified in CFC, it will override the value spec
<tr>
<td class="tblHead" width="150">#stText.Settings.orm.cfclocation#</td>
<td class="tblContent">
<input type="text" name="cfclocation" size="80" value="#settings.cfclocation#" /><br />
<input type="text" name="cfclocation" size="80" value="#settings.isDefaultCfclocation?"":arrayToList(settings.cfclocation)#" /><br />
<span class="comment">#stText.Settings.orm.cfclocationDesc#</span>


Expand Down Expand Up @@ -199,7 +264,7 @@ makes no sense to define this here
</td>
</tr>

<!--- sqlscript --->
<!--- sqlscript
<tr>
<td class="tblHead" width="150">#stText.Settings.orm.sqlscript#</td>
<td class="tblContent">
Expand All @@ -209,7 +274,7 @@ makes no sense to define this here
</td>
</tr>

--->
<!---
public static final Collection.Key SECONDARY_CACHE_ENABLED = KeyImpl.getInstance("secondarycacheenabled");
public static final Collection.Key CACHE_CONFIG = KeyImpl.getInstance("cacheconfig");
Expand All @@ -226,84 +291,14 @@ makes no sense to define this here
<cfmodule template="remoteclients.cfm" colspan="2">
<tr>
<td colspan="2">
<input type="submit" class="submit" name="mainAction1" value="#stText.Buttons.Update#">
<input type="submit" class="submit" name="mainAction" value="#stText.Buttons.Update#">
<input type="reset" class="reset" name="cancel" value="#stText.Buttons.Cancel#">
<cfif request.adminType EQ "web"><input class="submit" type="submit" class="submit" name="mainAction1" value="#stText.Buttons.resetServerAdmin#"></cfif>
<input class="submit" type="submit" class="submit" name="mainAction" value="#resetLabel#">
</td>
</tr>
</cfif>

</cfform>
</table>
<br /><br />

<h2>#stText.application.listener#</h2>
#stText.application.listenerDescription#

<table class="tbl" width="600">

<cfform action="#request.self#?action=#url.action#" method="post">

<!--- listener type
<tr>
<td class="tblHead">#stText.application.listenerType#</td>
<td class="tblContent">
<cfif hasAccess>
<span class="comment">#stText.application.listenerTypeDescription#</span><br />
<table class="tbl" width="600">
<cfloop index="key" list="none,classic,modern,mixed">
<tr>
<td width="200" class="tblHead" nowrap="nowrap">#stText.application['listenerType_' & key]#</td>
<td width="400" class="tblContent"><input type="radio" name="type" value="#key#" <cfif listener.type EQ key>checked="checked"</cfif>>
<span class="comment">#stText.application['listenerTypeDescription_' & key]#</span></td>
</tr>
</cfloop>
</table>
<cfelse>
<input type="hidden" name="type" value="#listener.type#">
<b>#listener.type#</b><br />
<span class="comment">#stText.application['listenerTypeDescription_' & listener.type]#</span>
</cfif>
</td>
</tr>
--->

<!--- listener mode
<tr>
<td class="tblHead">#stText.application.listenerMode#</td>
<td class="tblContent">
<cfif hasAccess>
<span class="comment">#stText.application.listenerModeDescription#</span><br />
<table class="tbl" width="600">
<cfloop index="key" list="curr,root,curr2root">
<tr>
<td width="200" class="tblHead" nowrap="nowrap">#stText.application['listenerMode_' & key]#</td>
<td width="400" class="tblContent"><input type="radio" name="mode" value="#key#" <cfif listener.mode EQ key>checked="checked"</cfif>>
<span class="comment">#stText.application['listenerModeDescription_' & key]#</span></td>
</tr>
</cfloop>
</table>
<cfelse>
<input type="hidden" name="type" value="#listener.mode#">
<b>#listener.mode#</b><br />
<span class="comment">#stText.application['listenerModeDescription_' & listener.mode]#</span>
</cfif>
</td>
</tr>
--->
<cfif hasAccess>
<cfmodule template="remoteclients.cfm" colspan="3">
<tr>
<td colspan="3">
<input type="submit" class="submit" name="mainAction2" value="#stText.Buttons.Update#">
<input type="reset" class="reset" name="cancel" value="#stText.Buttons.Cancel#">
<cfif request.adminType EQ "web"><input class="submit" type="submit" class="submit" name="mainAction2" value="#stText.Buttons.resetServerAdmin#"></cfif>
</td>
</tr>
</cfif>
</cfform></cfoutput>
</table>
<br><br>
</cfoutput>
47 changes: 47 additions & 0 deletions railo-java/railo-core/src/railo/runtime/config/ConfigWebAdmin.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
import railo.runtime.listener.ApplicationContextUtil;
import railo.runtime.net.ntp.NtpClient;
import railo.runtime.op.Caster;
import railo.runtime.orm.ORMConfiguration;
import railo.runtime.reflection.Reflector;
import railo.runtime.security.SecurityManager;
import railo.runtime.security.SecurityManagerImpl;
Expand Down Expand Up @@ -2823,6 +2824,50 @@ private void setExtensionAttrs(Element el, Extension extension) {


}


public void resetORMSetting() {
Element orm=_getRootElement("orm");
orm.getParentNode().removeChild(orm);
}


public void updateORMSetting(ORMConfiguration oc) {
Element orm=_getRootElement("orm");
orm.setAttribute("autogenmap",Caster.toString(oc.autogenmap(),"true"));
orm.setAttribute("event-handler",Caster.toString(oc.eventHandler(),""));
orm.setAttribute("event-handling",Caster.toString(oc.eventHandling(),"false"));
orm.setAttribute("flush-at-request-end",Caster.toString(oc.flushAtRequestEnd(),"true"));
orm.setAttribute("cache-provider",Caster.toString(oc.getCacheProvider(),""));
orm.setAttribute("cache-config",Caster.toString(oc.getCacheConfig(),"true"));
orm.setAttribute("catalog",Caster.toString(oc.getCatalog(),""));
orm.setAttribute("db-create",ORMConfiguration.dbCreateAsString(oc.getDbCreate()));
orm.setAttribute("dialect",Caster.toString(oc.getDialect(),""));
orm.setAttribute("schema",Caster.toString(oc.getSchema(),""));
orm.setAttribute("log-sql",Caster.toString(oc.logSQL(),"false"));
orm.setAttribute("save-mapping",Caster.toString(oc.saveMapping(),"false"));
orm.setAttribute("secondary-cache-enable",Caster.toString(oc.secondaryCacheEnabled(),"false"));
orm.setAttribute("use-db-for-mapping",Caster.toString(oc.useDBForMapping(),"true"));
orm.setAttribute("orm-config",Caster.toString(oc.getOrmConfig(),""));
orm.setAttribute("sql-script",Caster.toString(oc.getSqlScript(),"true"));

if(oc.isDefaultCfcLocation()) {
orm.removeAttribute("cfc-location");
}
else {
Resource[] locations = oc.getCfcLocations();
StringBuilder sb=new StringBuilder();
for(int i=0;i<locations.length;i++) {
if(i!=0)sb.append(",");
sb.append(locations[i].getAbsolutePath());
}
orm.setAttribute("cfc-location",sb.toString());
}


orm.setAttribute("sql-script",Caster.toString(oc.getSqlScript(),"true"));

}


public void removeExtension(String provider, String id) throws SecurityException {
Expand Down Expand Up @@ -3071,5 +3116,7 @@ public void updateSerial(String serial) throws PageException {






}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@
import railo.runtime.engine.ExecutionLog;
import railo.runtime.engine.ExecutionLogFactory;
import railo.runtime.engine.ThreadLocalConfig;
import railo.runtime.engine.ThreadLocalPageContext;
import railo.runtime.exp.ApplicationException;
import railo.runtime.exp.ExpressionException;
import railo.runtime.exp.PageException;
Expand Down
Loading

0 comments on commit a652874

Please sign in to comment.