001 package railo.runtime.config; 002 003 import java.io.IOException; 004 import java.io.PrintWriter; 005 import java.net.URL; 006 import java.util.Locale; 007 import java.util.Map; 008 import java.util.TimeZone; 009 010 import railo.commons.io.log.LogAndSource; 011 import railo.commons.io.res.Resource; 012 import railo.commons.io.res.ResourceProvider; 013 import railo.runtime.CFMLFactory; 014 import railo.runtime.Mapping; 015 import railo.runtime.PageSource; 016 import railo.runtime.cfx.CFXTagPool; 017 import railo.runtime.db.DataSource; 018 import railo.runtime.dump.DumpWriter; 019 import railo.runtime.exp.PageException; 020 import railo.runtime.extension.Extension; 021 import railo.runtime.extension.ExtensionProvider; 022 import railo.runtime.listener.ApplicationListener; 023 import railo.runtime.net.mail.Server; 024 import railo.runtime.schedule.Scheduler; 025 import railo.runtime.search.SearchEngine; 026 import railo.runtime.security.SecurityManager; 027 import railo.runtime.spooler.SpoolerEngine; 028 import railo.runtime.type.Struct; 029 import railo.runtime.type.dt.TimeSpan; 030 031 /** 032 * interface for Config Object 033 */ 034 public interface Config { 035 036 /** 037 * Define a strict scope cascading 038 */ 039 public static final short SCOPE_STRICT = 0; 040 041 /** 042 * Define a small scope cascading 043 */ 044 public static final short SCOPE_SMALL = 1; 045 046 /** 047 * Define a standart scope cascading (like other cf versions) 048 */ 049 public static final short SCOPE_STANDARD = 2; 050 051 /** 052 * Field <code>CLIENT_SCOPE_TYPE_COOKIE</code> 053 */ 054 public static final short CLIENT_SCOPE_TYPE_COOKIE = 0; 055 056 /** 057 * Field <code>CLIENT_SCOPE_TYPE_FILE</code> 058 */ 059 public static final short CLIENT_SCOPE_TYPE_FILE = 1; 060 061 /** 062 * Field <code>CLIENT_SCOPE_TYPE_DB</code> 063 */ 064 public static final short CLIENT_SCOPE_TYPE_DB = 2; 065 066 /** 067 * Field <code>SESSION_TYPE_CFML</code> 068 */ 069 public static final short SESSION_TYPE_CFML = 0; 070 071 /** 072 * Field <code>SESSION_TYPE_J2EE</code> 073 */ 074 public static final short SESSION_TYPE_J2EE = 1; 075 076 077 /** 078 * Field <code>RECOMPILE_NEVER</code> 079 */ 080 public static final short RECOMPILE_NEVER = 0; 081 /** 082 * Field <code>RECOMPILE_AT_STARTUP</code> 083 */ 084 public static final short RECOMPILE_AFTER_STARTUP = 1; 085 /** 086 * Field <code>RECOMPILE_ALWAYS</code> 087 */ 088 public static final short RECOMPILE_ALWAYS = 2; 089 090 091 /*public static final int CUSTOM_TAG_MODE_NONE = 0; 092 public static final int CUSTOM_TAG_MODE_CLASSIC = 1; 093 public static final int CUSTOM_TAG_MODE_MODERN = 2; 094 public static final int CUSTOM_TAG_MODE_CLASSIC_MODERN = 4; 095 public static final int CUSTOM_TAG_MODE_MODERN_CLASSIC = 8; 096 */ 097 098 099 /** 100 * return how railo cascade scopes 101 * @return type of cascading 102 */ 103 public abstract short getScopeCascadingType(); 104 105 /** 106 * return cfml extesnion 107 * @return cfml extension 108 */ 109 public abstract String[] getCFMLExtensions(); 110 111 public abstract String getCFCExtension(); 112 113 /** 114 * return the mapping to custom tag directory 115 * @return custom tag directory 116 */ 117 public abstract Mapping[] getCustomTagMappings(); 118 119 /** 120 * return if it is allowed to implizid query call, call a query member witot define name of the query. 121 * @return is allowed 122 */ 123 public abstract boolean allowImplicidQueryCall(); 124 125 /**e merged 126 * return if url and form scope will b 127 * @return merge or not 128 */ 129 public abstract boolean mergeFormAndURL(); 130 131 132 /** 133 * @return Returns the applicationTimeout. 134 */ 135 public abstract TimeSpan getApplicationTimeout(); 136 137 /** 138 * @return Returns the sessionTimeout. 139 */ 140 public abstract TimeSpan getSessionTimeout(); 141 142 /** 143 * @return Returns the requestTimeout. 144 */ 145 public abstract TimeSpan getRequestTimeout(); 146 147 /** 148 * @return Returns the clientCookies. 149 */ 150 public abstract boolean isClientCookies(); 151 152 /** 153 * @return Returns the clientManagement. 154 */ 155 public abstract boolean isClientManagement(); 156 157 /** 158 * @return Returns the domainCookies. 159 */ 160 public abstract boolean isDomainCookies(); 161 162 /** 163 * @return Returns the sessionManagement. 164 */ 165 public abstract boolean isSessionManagement(); 166 167 /** 168 * @return Returns the spoolEnable. 169 */ 170 public abstract boolean isMailSpoolEnable(); 171 172 /** 173 * @return Returns the mailTimeout. 174 */ 175 public abstract int getMailTimeout(); 176 177 /** 178 * @return preserve single quotes in cfquery tag or not 179 */ 180 public abstract boolean getPSQL(); 181 182 /** 183 * @return Returns the locale. 184 */ 185 public abstract Locale getLocale(); 186 187 /** 188 * return if debug output will be generated 189 * @return debug or not 190 */ 191 public abstract boolean debug(); 192 193 /** 194 * return the temp directory 195 * @return temp directory 196 */ 197 public abstract Resource getTempDirectory(); 198 199 /** 200 * @return Returns the spoolInterval. 201 */ 202 public abstract int getMailSpoolInterval(); 203 204 /** 205 * @return returns the time zone for this 206 */ 207 public abstract TimeZone getTimeZone(); 208 209 /** 210 * @return returns the offset from the timeserver to local time 211 */ 212 public abstract long getTimeServerOffset(); 213 214 /** 215 * @return return if a password is set 216 */ 217 public abstract boolean hasPassword(); 218 219 /** 220 * @param password 221 * @return return if a password is set 222 */ 223 public abstract boolean passwordEqual(String password); 224 225 /** 226 * @return return if a password is set 227 */ 228 public abstract boolean hasServerPassword(); 229 230 /** 231 * @return Returns the mappings. 232 */ 233 public abstract Mapping[] getMappings(); 234 235 /** 236 * @return Returns the configDir. 237 */ 238 public abstract Resource getConfigDir(); 239 240 /** 241 * @return Returns the configFile. 242 */ 243 public abstract Resource getConfigFile(); 244 245 /** 246 * @return Returns the loadTime. 247 */ 248 public abstract long getLoadTime(); 249 250 /** 251 * @return Returns the baseComponent. 252 */ 253 public abstract String getBaseComponentTemplate(); 254 255 /** 256 * @return returns the client type 257 */ 258 public abstract short getClientType(); 259 260 /** 261 * @return Returns the componentDataMemberDefaultAccess. 262 */ 263 public abstract int getComponentDataMemberDefaultAccess(); 264 265 /** 266 * @return Returns the timeServer. 267 */ 268 public abstract String getTimeServer(); 269 270 /** 271 * @return Returns the componentDump. 272 */ 273 public abstract String getComponentDumpTemplate(); 274 275 /** 276 * @return id of the config 277 */ 278 public abstract String getId(); 279 280 /** 281 * @return Returns the debug Template. 282 */ 283 public abstract String getDebugTemplate(); 284 285 /** 286 * @return Returns the error Template. 287 * @deprecated replaced with getErrorTemplate(int status) 288 */ 289 public abstract String getErrorTemplate(); 290 291 292 public abstract String getErrorTemplate(int statusCode); 293 294 /** 295 * @return Returns the sessionType. 296 */ 297 public abstract short getSessionType(); 298 299 /** 300 * @return returns the charset for the response and request 301 */ 302 public abstract String getWebCharset(); 303 /** 304 * @return returns the charset used to read cfml files 305 */ 306 public abstract String getTemplateCharset(); 307 /** 308 * @return returns the charset used to read and write resources 309 */ 310 public abstract String getResourceCharset(); 311 312 /** 313 * @return returns the default encoding for mail 314 */ 315 public String getMailDefaultEncoding(); 316 317 /** 318 * @return returns update type (auto or manual) 319 */ 320 public abstract String getUpdateType(); 321 322 /** 323 * @return returns URL for update 324 */ 325 public abstract URL getUpdateLocation(); 326 327 /** 328 * return directory, where railo deploy translated cfml classes (java and class files) 329 * @return deploy directory 330 */ 331 public abstract Resource getDeployDirectory(); 332 333 /** 334 * @return Returns the rootDir. 335 */ 336 public abstract Resource getRootDirectory(); 337 338 /** 339 * @return Returns the accessor. 340 */ 341 public abstract SecurityManager getSecurityManager(); 342 343 /** 344 * @return Returns the cfxTagPool. 345 * @throws PageException 346 */ 347 public abstract CFXTagPool getCFXTagPool() throws PageException; 348 349 /** 350 * @return returns the application logger 351 */ 352 public abstract LogAndSource getApplicationLogger(); 353 354 355 /** 356 * @return returns the exception logger 357 */ 358 public abstract LogAndSource getExceptionLogger(); 359 360 /** 361 * @return returns the trace logger 362 */ 363 public abstract LogAndSource getTraceLogger(); 364 365 /** 366 * @param password 367 * @return ConfigServer 368 * @throws PageException 369 */ 370 public abstract ConfigServer getConfigServer(String password) throws PageException; 371 372 373 /** 374 * @deprecated replaced with <code>getConfigServer(String password)</code> 375 * @return 376 */ 377 public abstract ConfigServer getConfigServer(); 378 379 /** 380 * @return Returns the mailLogger. 381 */ 382 public abstract LogAndSource getMailLogger(); 383 384 /** 385 * @return Returns the request timeout Directory. 386 */ 387 public LogAndSource getRequestTimeoutLogger(); 388 389 /** 390 * @return returns schedule logger 391 */ 392 public LogAndSource getScheduleLogger(); 393 394 /** 395 * reload the time offset to a time server 396 */ 397 public void reloadTimeServerOffset(); 398 399 /** 400 * reset config 401 */ 402 public void reset(); 403 404 /** 405 * @return return the search Storage 406 */ 407 public SearchEngine getSearchEngine(); 408 409 /** 410 * @return return the Scheduler 411 */ 412 public Scheduler getScheduler(); 413 414 /** 415 * @return return all defined Mail Servers 416 */ 417 public Server[] getMailServers(); 418 419 /** 420 * return the compile type of this context 421 */ 422 public short getCompileType(); 423 424 /** 425 * return the all datasources 426 */ 427 public DataSource[] getDataSources(); 428 429 430 /** 431 * @param path get a resource that match this path 432 * @return resource matching path 433 */ 434 public Resource getResource(String path); 435 436 437 /** 438 * return current application listener 439 * @return application listener 440 */ 441 public ApplicationListener getApplicationListener(); 442 443 444 /** 445 * @return the scriptProtect 446 */ 447 public int getScriptProtect(); 448 449 450 /** 451 * return default proxy setting password 452 * @return the password for proxy 453 */ 454 public String getProxyPassword(); 455 456 /** 457 * return default proxy setting port (default 80) 458 * @return the port for proxy 459 */ 460 public int getProxyPort(); 461 462 /** 463 * return default proxy setting server 464 * @return the server for proxy 465 */ 466 public String getProxyServer(); 467 468 /** 469 * return default proxy setting username 470 * @return the username for proxy 471 */ 472 public String getProxyUsername(); 473 474 /** 475 * return if proxy is enabled or not 476 * @return is proxy enabled 477 */ 478 public boolean isProxyEnableFor(String host); 479 480 /** 481 * @return the triggerComponentDataMember 482 */ 483 public boolean getTriggerComponentDataMember(); 484 485 486 public abstract Resource getClientScopeDir(); 487 488 public abstract long getClientScopeDirSize(); 489 490 public abstract ClassLoader getRPCClassLoader(boolean reload) throws IOException; 491 492 public Resource getCacheDir(); 493 494 public long getCacheDirSize(); 495 496 /** 497 * returns the default DumpWriter 498 * @param defaultType 499 * @return default DumpWriter 500 * @deprecated use instead <code>getDefaultDumpWriter(int defaultType)</code> 501 */ 502 public abstract DumpWriter getDefaultDumpWriter(); 503 504 /** 505 * returns the default DumpWriter 506 * @param defaultType 507 * @return default DumpWriter 508 */ 509 public abstract DumpWriter getDefaultDumpWriter(int defaultType); 510 511 /** 512 * returns the DumpWriter matching key 513 * @param key key for DumpWriter 514 * @param defaultType 515 * @return matching DumpWriter 516 * @throws PageException if there is no DumpWriter for this key 517 */ 518 public abstract DumpWriter getDumpWriter(String key,int defaultType) throws PageException; 519 520 /** 521 * returns the DumpWriter matching key 522 * @param key key for DumpWriter 523 * @return matching DumpWriter 524 * @deprecated use instead <code>getDumpWriter(String key,int defaultType)</code> 525 * @throws PageException if there is no DumpWriter for this key 526 */ 527 public abstract DumpWriter getDumpWriter(String key) throws PageException; 528 529 530 /** 531 * define if components has a "shadow" in the component variables scope or not. 532 * @return 533 */ 534 public abstract boolean useComponentShadow(); 535 536 537 /* * 538 * return a database connection hold inside by a datasource definition 539 * @param datasource definiti0on of the datasource 540 * @param user username to connect 541 * @param pass password to connect 542 * @return datasource connnection 543 * @throws PageException 544 */ 545 //public DatasourceConnection getConnection(String datasource, String user, String pass) throws PageException; 546 547 /* * 548 * @return returns the ConnectionPool 549 */ 550 551 552 /** 553 * FUTURE deprecated use <code>public Mapping[] getComponentMappings()</code> instead 554 */ 555 public Mapping getComponentMapping(); 556 557 // FUTURE public Mapping[] getComponentMappings(); 558 559 public abstract boolean doCustomTagDeepSearch(); 560 561 /* * 562 * return mapping that match Resource 563 * @param res 564 * @return 565 * / 566 //public abstract PageSource toPageSourceX(Resource res, PageSource defaultValue); 567 568 /** 569 * @return returns the error print writer stream 570 */ 571 public abstract PrintWriter getErrWriter(); 572 573 /** 574 * @return returns the out print writer stream 575 */ 576 public abstract PrintWriter getOutWriter(); 577 578 /** 579 * define if railo search in local directory for custom tags or not 580 * @return search in local dir? 581 */ 582 public abstract boolean doLocalCustomTag(); 583 584 public String[] getCustomTagExtensions(); 585 586 /** 587 * @return if error status code will be returned or not 588 */ 589 public boolean getErrorStatusCode(); 590 591 592 public abstract int getLocalMode(); 593 594 /** 595 * @return return the class defined for the cluster scope 596 */ 597 public Class getClusterClass(); 598 599 /** 600 * @return classloader of ths context 601 */ 602 public ClassLoader getClassLoader(); 603 604 public Resource getExtensionDirectory(); 605 606 public ExtensionProvider[] getExtensionProviders(); 607 608 public Extension[] getExtensions(); 609 610 public PageSource getBaseComponentPageSource(); 611 612 public boolean allowRealPath(); 613 614 public Struct getConstants(); 615 616 public DataSource getDataSource(String datasource) throws PageException; 617 618 public Map getDataSourcesAsMap(); 619 620 public String getDefaultEncoding(); 621 622 public ResourceProvider getDefaultResourceProvider(); 623 624 public CFMLFactory getFactory(); 625 626 public boolean isExtensionEnabled(); 627 628 public Resource getFldFile(); 629 630 /** 631 * @return the tldFile 632 */ 633 public Resource getTldFile(); 634 635 636 // FUTURE @deprecated use instead getPageSources or getPageSourceExisting 637 /** 638 * get PageSource of the first Mapping that match the given criteria 639 * @param mappings per application mappings 640 * @param realPath path to get PageSource for 641 * @param onlyTopLevel checks only toplevel mappings 642 */ 643 public PageSource getPageSource(Mapping[] mappings, String realPath,boolean onlyTopLevel); 644 645 /* FUTURE 646 * return existing PageSource that match the given criteria, if there is no PageSource null is returned. 647 * @param pc current PageContext 648 * @param mappings per application mappings 649 * @param realPath path to get PageSource for 650 * @param onlyTopLevel checks only toplevel mappings 651 * @param useSpecialMappings invoke special mappings like "mapping-tag" or "mapping-customtag" 652 * @param useDefaultMapping also invoke the always existing default mapping "/" 653 */ 654 //public PageSource getPageSourceExisting(PageContext pc,Mapping[] mappings, String realPath,boolean onlyTopLevel,boolean useSpecialMappings, boolean useDefaultMapping, boolean onlyPhysicalExisting); 655 656 /* FUTURE 657 * get all PageSources that match the given criteria 658 * @param pc current PageContext 659 * @param mappings per application mappings 660 * @param realPath path to get PageSource for 661 * @param onlyTopLevel checks only toplevel mappings 662 * @param useSpecialMappings invoke special mappings like "mapping-tag" or "mapping-customtag" 663 * @param useDefaultMapping also invoke the always existing default mapping "/" 664 */ 665 //public PageSource[] getPageSources(PageContext pc,Mapping[] mappings, String realPath,boolean onlyTopLevel,boolean useSpecialMappings, boolean useDefaultMapping); 666 667 668 // FUTURE @deprecated use instead getPhysicalResources or getPhysicalResourceExisting 669 /** 670 * get Resource of the first Mapping that match the given criteria 671 * @param mappings per application mappings 672 * @param realPath path to get PageSource for 673 * @param onlyTopLevel checks only toplevel mappings 674 */ 675 public Resource getPhysical(Mapping[] mappings, String realPath, boolean alsoDefaultMapping); 676 677 /* FUTURE 678 * get all Resources that match the given criteria 679 * @param pc current PageContext 680 * @param mappings per application mappings 681 * @param realPath path to get PageSource for 682 * @param onlyTopLevel checks only toplevel mappings 683 * @param useSpecialMappings invoke special mappings like "mapping-tag" or "mapping-customtag" 684 * @param useDefaultMapping also invoke the always existing default mapping "/" 685 */ 686 //public Resource[] getPhysicalResources(PageContext pc,Mapping[] mappings, String realPath,boolean onlyTopLevel,boolean useSpecialMappings, boolean useDefaultMapping); 687 688 /* FUTURE 689 * return existing Resource that match the given criteria, if there is no Resource null is returned. 690 * @param pc current PageContext 691 * @param mappings per application mappings 692 * @param realPath path to get Resource for 693 * @param onlyTopLevel checks only toplevel mappings 694 * @param useSpecialMappings invoke special mappings like "mapping-tag" or "mapping-customtag" 695 * @param useDefaultMapping also invoke the always existing default mapping "/" 696 */ 697 //public Resource getPhysicalResourceExisting(PageContext pc,Mapping[] mappings, String realPath,boolean onlyTopLevel,boolean useSpecialMappings, boolean useDefaultMapping); 698 699 700 public Resource getRemoteClientDirectory(); 701 702 public LogAndSource getRemoteClientLog(); 703 704 public RemoteClient[] getRemoteClients(); 705 706 public SpoolerEngine getSpoolerEngine(); 707 708 public ResourceProvider[] getResourceProviders(); 709 710 public double getVersion(); 711 712 public Resource getVideoDirectory(); 713 714 //public String getVideoProviderLocation(); 715 716 public boolean isShowVersion(); 717 718 public boolean isSuppressWhitespace(); 719 720 //public boolean isVideoAgreementAccepted(); 721 722 public Struct getRemoteClientUsage(); 723 724 public Class getAdminSyncClass(); 725 726 public Class getVideoExecuterClass(); 727 728 729 730 }