1 23 24 package org.apache.slide.common; 25 26 import java.lang.reflect.Constructor ; 27 import java.lang.reflect.Method ; 28 import java.util.Enumeration ; 29 import java.util.Hashtable ; 30 import java.util.Vector ; 31 import javax.transaction.Status ; 32 import javax.transaction.SystemException ; 33 import javax.transaction.TransactionManager ; 34 import org.apache.slide.authenticate.CredentialsToken; 35 import org.apache.slide.content.ContentInterceptor; 36 import org.apache.slide.extractor.Extractor; 37 import org.apache.slide.extractor.ExtractorManager; 38 import org.apache.slide.store.ContentStore; 39 import org.apache.slide.store.DefaultIndexer; 40 import org.apache.slide.store.IndexStore; 41 import org.apache.slide.store.LockStore; 42 import org.apache.slide.store.NodeStore; 43 import org.apache.slide.store.RevisionDescriptorStore; 44 import org.apache.slide.store.RevisionDescriptorsStore; 45 import org.apache.slide.store.SecurityStore; 46 import org.apache.slide.store.SequenceStore; 47 import org.apache.slide.store.Store; 48 import org.apache.slide.structure.ObjectAlreadyExistsException; 49 import org.apache.slide.structure.SubjectNode; 50 import org.apache.slide.transaction.SlideTransactionManager; 51 import org.apache.slide.util.conf.Configurable; 52 import org.apache.slide.util.conf.Configuration; 53 import org.apache.slide.util.conf.ConfigurationException; 54 import org.apache.slide.util.logger.Logger; 55 56 92 public final class Namespace { 93 94 95 97 98 public static final String REFERENCE = "reference"; 99 public static final String NODE_STORE = "nodestore"; 100 public static final String SECURITY_STORE = "securitystore"; 101 public static final String LOCK_STORE = "lockstore"; 102 public static final String REVISION_DESCRIPTORS_STORE = 103 "revisiondescriptorsstore"; 104 public static final String REVISION_DESCRIPTOR_STORE = 105 "revisiondescriptorstore"; 106 public static final String CONTENT_STORE = "contentstore"; 107 public static final String PROPERTIES_INDEX_STORE = "propertiesindexer"; 108 public static final String CONTENT_INDEX_STORE = "contentindexer"; 109 public static final String SEQUENCE_STORE = "sequencestore"; 110 111 112 115 private static final String LOG_CHANNEL = Namespace.class.getName(); 116 117 protected static final String I_CREATESTORELISTENERCLASS = "createStoreListenerClass"; 118 protected static final String I_CREATESTORELISTENERCLASS_DEFAULT = "org.apache.slide.webdav.util.UriHandler"; 119 120 protected static Class createStoreListenerClass; 121 122 123 static { 124 try { 125 String createStoreListenerClassName = Domain.getParameter(I_CREATESTORELISTENERCLASS, I_CREATESTORELISTENERCLASS_DEFAULT); 126 createStoreListenerClass = Class.forName( createStoreListenerClassName ); 127 } 128 catch( Exception x ) { 129 Domain.warn( "Loading of create_store_listener class failed: "+x.getMessage() ); 130 } 131 } 132 133 135 136 139 private String name; 140 141 142 145 private String searchClassName; 146 147 148 152 private transient Vector connectedServices; 153 154 155 158 private transient Hashtable stores; 159 160 161 164 private NamespaceConfig config; 165 166 167 170 private Hashtable uriCache; 171 172 173 176 private String defaultStoreClassname = 177 "org.apache.slide.store.ExtendedStore"; 178 179 180 183 private TransactionManager transactionManager = 184 new SlideTransactionManager(); 185 186 187 190 private Logger logger; 191 192 193 196 private Logger applicationLogger; 197 198 199 201 202 205 Namespace() { 206 stores = new Hashtable (); 207 connectedServices = new Vector (); 208 name = new String (); 209 uriCache = new Hashtable (); 210 } 211 212 213 215 216 221 public void setName(String name) { 222 this.name = name; 223 } 224 225 226 231 public String getName() { 232 return name; 233 } 234 235 236 241 public void setSearchClassName (String searchClassName) { 242 this.searchClassName = searchClassName; 243 } 244 245 246 251 public String getSearchClassName() { 252 return searchClassName; 253 } 254 255 256 261 public NamespaceConfig getConfig() { 262 return config; 263 } 264 265 266 271 public Enumeration enumerateScopes() { 272 return stores.keys(); 273 } 274 275 276 277 280 public TransactionManager getTransactionManager() { 281 return transactionManager; 282 } 283 284 285 288 public Logger getLogger() { 289 if (logger != null) 290 return logger; 291 else 292 return Domain.getLogger(); 293 } 294 295 296 299 public void setLogger(Logger logger) { 300 this.logger = logger; 301 if (transactionManager instanceof SlideTransactionManager) { 302 ((SlideTransactionManager) transactionManager).setLogger(logger); 303 } 304 } 305 306 307 310 public Logger getApplicationLogger() { 311 if (applicationLogger != null) 312 return applicationLogger; 313 else if (logger != null) 314 return logger; 315 else 316 return Domain.getLogger(); 317 } 318 319 320 323 public void setApplicationLogger(Logger logger) { 324 this.applicationLogger = logger; 325 } 326 327 328 330 331 346 public void registerStore(String storeName, Class storeClass, 347 Hashtable parameters, Scope scope, 348 Hashtable childStores) 349 throws ServiceRegistrationFailedException, 350 ServiceParameterErrorException, ServiceParameterMissingException { 351 if (!stores.containsKey(scope)) { 352 try { 353 Store store = (Store) storeClass.newInstance(); 354 store.setName(storeName); 355 store.setParameters(parameters); 356 stores.put(scope, store); 357 358 NodeStore nodeStore = 360 (NodeStore) dereferenceStore (NODE_STORE, childStores); 361 362 store.setNodeStore (nodeStore); 363 364 SecurityStore securityStore = 366 (SecurityStore) dereferenceStore (SECURITY_STORE, childStores); 367 368 store.setSecurityStore (securityStore); 369 370 LockStore lockStore = 372 (LockStore) dereferenceStore (LOCK_STORE, childStores); 373 374 store.setLockStore (lockStore); 375 376 RevisionDescriptorsStore revisionDescriptorsStore = 378 (RevisionDescriptorsStore) dereferenceStore 379 (REVISION_DESCRIPTORS_STORE, childStores); 380 381 store.setRevisionDescriptorsStore (revisionDescriptorsStore); 382 383 RevisionDescriptorStore revisionDescriptorStore = 385 (RevisionDescriptorStore) dereferenceStore 386 (REVISION_DESCRIPTOR_STORE, childStores); 387 388 store.setRevisionDescriptorStore (revisionDescriptorStore); 389 390 ContentStore contentStore = 392 (ContentStore) dereferenceStore (CONTENT_STORE, childStores); 393 394 store.setContentStore (contentStore); 395 396 IndexStore propertiesIndexer = 398 (IndexStore) dereferenceStore (PROPERTIES_INDEX_STORE, childStores); 399 400 if (propertiesIndexer == null) { 402 propertiesIndexer = new DefaultIndexer (revisionDescriptorStore); 403 childStores.put (PROPERTIES_INDEX_STORE, propertiesIndexer); 404 } 405 406 store.setPropertiesIndexer (propertiesIndexer); 407 408 IndexStore contentIndexer = 410 (IndexStore) dereferenceStore (CONTENT_INDEX_STORE, childStores); 411 412 if (contentIndexer == null) { 414 contentIndexer = new DefaultIndexer (contentStore); 415 childStores.put (CONTENT_INDEX_STORE, contentIndexer); 416 } 417 418 store.setContentIndexer (contentIndexer); 419 420 SequenceStore sequenceStore = 422 (SequenceStore) dereferenceStore (SEQUENCE_STORE, childStores); 423 424 store.setSequenceStore(sequenceStore); 425 426 store.setScope(scope); 428 429 notifyStoreCreated( this.name, scope.toString(), storeName ); 431 432 } catch(InstantiationException e) { 433 throw new ServiceRegistrationFailedException 434 (storeClass); 435 } catch(IllegalAccessException e) { 436 throw new ServiceRegistrationFailedException 437 (storeClass); 438 } catch(NullPointerException e) { 439 throw new ServiceRegistrationFailedException 440 (storeClass); 441 } catch(ClassCastException e) { 442 getLogger().log(e,LOG_CHANNEL, Logger.ERROR); 444 throw new ServiceRegistrationFailedException 446 (storeClass); 447 } 448 449 } 450 } 451 452 453 Object dereferenceStore (String storeType, Hashtable childStores) { 454 Object result; 455 456 Object o = childStores.get(storeType); 457 if (o instanceof String ) { 458 result = childStores.get(o); 459 } else { 460 result = o; 461 } 462 return result; 463 } 464 465 466 473 public void initializeServices() 474 throws ServicesInitializationFailedException { 475 476 ServicesInitializationFailedException nestedException 479 = new ServicesInitializationFailedException(); 480 481 Enumeration serviceList = stores.elements(); 483 while (serviceList.hasMoreElements()) { 484 Service service = (Service) serviceList.nextElement(); 485 try { 486 getLogger().log("Initializing Store " + service,LOG_CHANNEL,Logger.INFO); 487 service.setNamespace(this); 488 service.initialize(new NamespaceAccessTokenImpl(this)); 489 } catch (ServiceInitializationFailedException e) { 490 nestedException.addException(e); 493 } 494 } 495 496 if (!nestedException.isEmpty()) { 498 throw nestedException; 499 } 500 501 } 502 503 504 507 public void clearNamespace() { 508 stores.clear(); 509 } 510 511 512 521 public void connectService(Service service, CredentialsToken token) 522 throws ServiceConnectionFailedException, ServiceAccessException { 523 boolean newConnection = service.connectIfNeeded(token); 525 526 if (newConnection) { 529 connectedServices.addElement(service); 530 } 531 } 532 533 534 540 public void disconnectServices() 541 throws ServicesShutDownFailedException { 542 543 ServicesShutDownFailedException nestedException 546 = new ServicesShutDownFailedException(); 547 548 for (int i=0; i<connectedServices.size(); i++) { 549 try { 550 Service service = (Service) connectedServices.elementAt(i); 551 if (service.isConnected()) { 552 getLogger().log("Shutting down service " + service,LOG_CHANNEL,Logger.INFO); 553 service.disconnect(); 554 } 555 } catch (ServiceDisconnectionFailedException e) { 556 nestedException.addException(e); 557 } catch (ServiceAccessException e) { 558 nestedException.addException(e); 559 } 560 } 561 connectedServices.removeAllElements(); 562 563 if (!nestedException.isEmpty()) { 565 throw nestedException; 566 } 567 568 } 569 570 571 580 public void unregisterStore(Scope scope) 581 throws ServiceDisconnectionFailedException, ServiceAccessException { 582 if (stores.containsKey(scope)) { 583 Store store = (Store) stores.get(scope); 584 if (store.isConnected()) { 585 store.disconnect(); 586 connectedServices.removeElement(store); 587 } 588 stores.remove(scope); 589 store = null; 590 } 591 } 592 593 594 601 public Store getStore(Scope scope) { 602 Store store = null; 603 if (stores.containsKey(scope)) { 604 store = (Store) stores.get(scope); 605 } 606 return store; 607 } 608 609 610 619 public Store retrieveStore(Scope scope, CredentialsToken token) 620 throws ServiceConnectionFailedException, ServiceAccessException { 621 Store store = getStore(scope); 622 if (store != null) { 623 connectService(store, token); 624 } 625 return store; 626 } 627 628 629 638 public Uri getUri(String uri) { 639 return getUri(null, uri); 640 } 641 642 643 650 public Uri getUri(SlideToken token, String uri) { 651 return getUri(token, uri, token==null 652 ?false 653 :token.isForceStoreEnlistment()); 654 } 655 656 657 665 public Uri getUri(SlideToken token, String uri, boolean forcedEnlistment) { 666 667 Uri result = null; 668 Object temp = null; 669 temp = uriCache.get(uri); 670 if (temp == null) { 671 result = new Uri(token, this, uri); 672 uriCache.put(uri, result); 673 if (uriCache.size() > 10000) { 674 clearUriCache(); 675 } 676 } else { 677 result = (Uri) temp; 678 result = result.cloneObject(); 679 result.setToken(token); 680 result.reconnectServices(); 681 } 682 683 if (token != null && token.isForceStoreEnlistment() != forcedEnlistment) { 686 SlideToken wToken = new SlideTokenWrapper(token); 687 wToken.setForceStoreEnlistment(forcedEnlistment); 688 result.setToken(wToken); 689 } 690 691 return result; 692 693 } 694 695 696 699 void clearUriCache() { 700 uriCache.clear(); 701 } 702 703 704 707 public ContentInterceptor[] getContentInterceptors() { 708 return config.getContentInterceptors(); 709 } 710 711 712 714 715 725 void loadDefinition(Configuration definition) 726 throws SlideException, ConfigurationException { 727 728 getLogger().log("Loading namespace definition",LOG_CHANNEL,Logger.INFO); 729 730 732 Hashtable storesClass = new Hashtable (); 733 Hashtable storesParameters = new Hashtable (); 734 Hashtable childStores = new Hashtable (); 735 736 Enumeration storeDefinitions = 737 definition.getConfigurations("store"); 738 739 while (storeDefinitions.hasMoreElements()) { 740 loadStoreDefinition 741 ((Configuration) storeDefinitions.nextElement(), 742 storesClass, storesParameters, childStores); 743 } 744 745 Enumeration scopeDefinitions = 746 definition.getConfigurations("scope"); 747 748 while (scopeDefinitions.hasMoreElements()) { 749 loadScopeDefinition 750 ((Configuration) scopeDefinitions.nextElement(), 751 storesClass, storesParameters, childStores); 752 } 753 754 initializeServices(); 756 757 } 758 759 760 768 void loadBaseData(Configuration namespaceBaseDataDefinition) 769 throws SlideException, ConfigurationException { 770 771 getLogger().log("Loading namespace " + getName() + " base data",LOG_CHANNEL,Logger.INFO); 772 773 try { 775 getTransactionManager().begin(); 777 778 SlideToken slideToken = new SlideTokenImpl(new CredentialsToken("")); 779 slideToken.setForceStoreEnlistment(true); 780 781 Uri rootUri = getUri(slideToken, "/"); 783 SubjectNode rootNode = new SubjectNode("/"); 784 try { 785 rootUri.getStore().createObject(rootUri, rootNode); 786 } catch (ObjectAlreadyExistsException e) { 787 getTransactionManager().rollback(); 789 getTransactionManager().begin(); 791 } 792 793 getTransactionManager().commit(); 795 796 getLogger().log("Init namespace " + getName() + " configuration",LOG_CHANNEL,Logger.INFO); 797 798 config.initializeAsDummyConfig(this); 800 801 NamespaceAccessToken token = new NamespaceAccessTokenImpl(this); 803 804 token.begin(); 806 807 getLogger().log("Import data into namespace " + getName(),LOG_CHANNEL,Logger.INFO); 808 token.importData(slideToken, namespaceBaseDataDefinition); 809 810 token.commit(); 812 813 getTransactionManager().begin(); 815 816 getLogger().log("Finish init namespace " + getName() + " configuration",LOG_CHANNEL,Logger.INFO); 817 818 rootNode = 820 (SubjectNode) rootUri.getStore().retrieveObject(rootUri); 821 rootUri.getStore().storeObject(rootUri, rootNode); 822 823 getTransactionManager().commit(); 825 826 } catch (SlideException e) { 827 e.printStackTrace(); 830 getLogger().log("Namespace base configuration was already done before",LOG_CHANNEL,Logger.INFO); 831 try { 832 if (getTransactionManager().getStatus()==Status.STATUS_ACTIVE) 833 getTransactionManager().rollback(); 834 } 835 catch (SystemException ex) { 836 getLogger().log("Could not rollback namespace base configuration: " + ex.toString(),LOG_CHANNEL,Logger.WARNING); 837 } 838 } catch (Exception e) { 839 getLogger().log("Unable to read Namespace base configuration file : ",LOG_CHANNEL,Logger.ERROR); 840 getLogger().log(e,LOG_CHANNEL, Logger.ERROR); 841 try { 844 if (getTransactionManager().getStatus()==Status.STATUS_ACTIVE) 845 getTransactionManager().rollback(); 846 } 847 catch (SystemException ex) { 848 getLogger().log("Could not rollback namespace base configuration after load error: " + ex.toString(),LOG_CHANNEL,Logger.WARNING); 849 } 850 } 851 } 852 853 854 862 void loadConfiguration(Configuration namespaceConfigurationDefinition) 863 throws SlideException { 864 865 getLogger().log("Loading namespace " + getName() + " configuration",LOG_CHANNEL,Logger.INFO); 866 867 config = new NamespaceConfig(); 869 config.initializeNamespaceConfig(this, 870 namespaceConfigurationDefinition); 871 872 } 873 874 875 883 void loadParameters(Configuration namespaceConfigurationDefinition) 884 throws SlideException { 885 886 getLogger().log("Loading namespace " + getName() + " parameters",LOG_CHANNEL,Logger.INFO); 887 888 config = new NamespaceConfig(); 890 config.initializeNamespaceParameters(this, 891 namespaceConfigurationDefinition); 892 893 } 894 895 896 void loadExtractors(Configuration namespaceExtractorsDefinition) 897 throws SlideException { 898 899 getLogger().log("Loading namespace " + getName() + " extractors",LOG_CHANNEL,Logger.INFO); 900 901 Enumeration extractorConfigs = namespaceExtractorsDefinition.getConfigurations("extractor"); 902 while (extractorConfigs.hasMoreElements()) { 903 Configuration extractorConfig = (Configuration) extractorConfigs.nextElement(); 904 String classname = extractorConfig.getAttribute("classname"); 905 String uri = extractorConfig.getAttribute("uri", null); 906 String contentType = extractorConfig.getAttribute("content-type", null); 907 String namespace = getName(); 908 try { 909 Class extractorClass = Class.forName(classname); 910 Extractor extractor = null; 911 Constructor extractorConstructor = extractorClass.getConstructor(new Class [] { String .class, String .class, String .class } ); 912 extractor = (Extractor)extractorConstructor.newInstance(new String [] { uri, contentType, namespace }); 913 if ( extractor instanceof Configurable ) { 914 ((Configurable)extractor).configure(extractorConfig.getConfiguration("configuration")); 915 } 916 ExtractorManager.getInstance().addExtractor(extractor); 917 } catch (ClassCastException e) { 918 throw new ConfigurationException("Extractor '"+classname+"' is not of type Extractor", namespaceExtractorsDefinition); 919 } catch (ConfigurationException e) { 920 throw e; 921 } catch (Exception e) { 922 throw new ConfigurationException("Extractor '"+classname+"' could not be loaded", namespaceExtractorsDefinition); 923 } 924 } 925 } 926 927 929 930 940 private void loadStoreDefinition 941 (Configuration storeDefinition, 942 Hashtable storesClass, 943 Hashtable storesParameters, 944 Hashtable childStores) 945 throws ConfigurationException, SlideException { 946 947 String storeName = storeDefinition.getAttribute("name"); 948 String storeClassname = defaultStoreClassname; 949 950 try { 951 storeClassname = storeDefinition.getAttribute("classname"); 952 } catch (ConfigurationException e) { 953 } 954 955 Enumeration storeParametersDefinitions = 956 storeDefinition.getConfigurations("parameter"); 957 958 Class storeClass = null; 960 try { 961 storeClass = Class.forName(storeClassname); 962 } catch (Exception e) { 963 getLogger().log(e,LOG_CHANNEL, Logger.ERROR); 964 throw new SlideException(e.getMessage()); 965 } 966 storesClass.put(storeName, storeClass); 967 968 Hashtable storeParameters = new Hashtable (); 970 while (storeParametersDefinitions.hasMoreElements()) { 971 Configuration parameterDefinition = (Configuration) 972 storeParametersDefinitions.nextElement(); 973 String parameterName = parameterDefinition.getAttribute("name"); 974 String parameterValue = parameterDefinition.getValue(); 975 storeParameters.put(parameterName, parameterValue); 976 } 977 978 storesParameters.put(storeName, storeParameters); 979 980 982 Hashtable currentStoreChildStores = new Hashtable (); 983 984 getChildStore (storeDefinition, NODE_STORE, currentStoreChildStores, storeParameters); 986 987 getChildStore (storeDefinition, SECURITY_STORE, currentStoreChildStores, storeParameters); 989 990 getChildStore (storeDefinition, LOCK_STORE, currentStoreChildStores, storeParameters); 992 993 getChildStore (storeDefinition, REVISION_DESCRIPTORS_STORE, currentStoreChildStores, storeParameters); 995 996 getChildStore (storeDefinition, REVISION_DESCRIPTOR_STORE, currentStoreChildStores, storeParameters); 998 999 getChildStore (storeDefinition, CONTENT_STORE, currentStoreChildStores, storeParameters); 1001 1002 getChildStore (storeDefinition, PROPERTIES_INDEX_STORE, currentStoreChildStores, storeParameters); 1004 1005 getChildStore (storeDefinition, CONTENT_INDEX_STORE, currentStoreChildStores, storeParameters); 1007 1008 1010 getChildStore (storeDefinition, SEQUENCE_STORE, currentStoreChildStores, storeParameters); 1012 1013 childStores.put(storeName, currentStoreChildStores); 1014 1015 } 1016 1017 private void getChildStore(Configuration storeDefinition, String key, Hashtable currentStoreChildStores, Hashtable storeParameters) throws SlideException 1018 { 1019 Configuration localStoreDefinition; 1020 try { 1021 localStoreDefinition = storeDefinition.getConfiguration(key); 1022 } catch (ConfigurationException e) { 1023 return; 1024 } 1026 try { 1027 try { 1028 Configuration referenceDefinition = 1029 localStoreDefinition.getConfiguration(REFERENCE); 1030 currentStoreChildStores.put 1031 (key, referenceDefinition.getAttribute("store")); 1032 getLogger().log(key + " references " + referenceDefinition.getAttribute("store"),LOG_CHANNEL,Logger.INFO); 1033 } catch (ConfigurationException ex) { 1034 getLogger().log(key + ": " + localStoreDefinition.getAttribute("classname"),LOG_CHANNEL,Logger.INFO); 1035 Service store = 1036 loadChildStore(localStoreDefinition, 1037 storeParameters); 1038 if (store != null) { 1039 currentStoreChildStores.put(key, store); 1040 } 1041 } 1042 } catch (ConfigurationException e) { 1043 getLogger().log("Exception while loading "+key+"!", e, LOG_CHANNEL, Logger.WARNING); 1044 } 1045 } 1046 1047 1048 1057 private Service loadChildStore(Configuration childStoreDefinition, 1058 Hashtable fatherParameters) 1059 throws ConfigurationException, SlideException { 1060 1061 String childStoreClassname = 1063 childStoreDefinition.getAttribute("classname"); 1064 1065 Service childStore = null; 1067 try { 1068 Class childStoreClass = 1069 Class.forName(childStoreClassname); 1070 childStore = (Service) childStoreClass.newInstance(); 1071 } catch (Exception e) { 1072 getLogger().log(e,LOG_CHANNEL, Logger.ERROR); 1073 return null; 1074 } 1075 1076 Hashtable childStoreParameters = new Hashtable (); 1078 Enumeration fatherParametersKeys = fatherParameters.keys(); 1079 while (fatherParametersKeys.hasMoreElements()) { 1080 Object key = fatherParametersKeys.nextElement(); 1081 Object value = fatherParameters.get(key); 1082 childStoreParameters.put(key, value); 1083 } 1084 1085 Enumeration childStoreParametersDefinitions = 1087 childStoreDefinition.getConfigurations("parameter"); 1088 while (childStoreParametersDefinitions.hasMoreElements()) { 1089 Configuration parameterDefinition = (Configuration) 1090 childStoreParametersDefinitions.nextElement(); 1091 String parameterName = parameterDefinition.getAttribute("name"); 1092 String parameterValue = parameterDefinition.getValue(); 1093 childStoreParameters.put(parameterName, parameterValue); 1094 } 1095 childStore.setParameters(childStoreParameters); 1096 1097 return childStore; 1098 1099 } 1100 1101 1102 1115 private void loadScopeDefinition(Configuration scopeDefinition, 1116 Hashtable storesClass, 1117 Hashtable storesParameters, 1118 Hashtable childStores) 1119 throws ConfigurationException, UnknownServiceDeclarationException, 1120 ServiceParameterErrorException, ServiceParameterMissingException, 1121 ServiceRegistrationFailedException { 1122 1123 String match = scopeDefinition.getAttribute("match"); 1124 1125 String storeName = scopeDefinition.getAttribute("store"); 1127 1128 if (storeName != null) { 1129 if ((!storesClass.containsKey(storeName)) || 1130 (!storesParameters.containsKey(storeName))) { 1131 throw new UnknownServiceDeclarationException(storeName); 1132 } 1133 registerStore(storeName, 1134 (Class ) storesClass.get(storeName), 1135 (Hashtable ) storesParameters.get(storeName), 1136 new Scope(match), 1137 (Hashtable ) childStores.get(storeName)); 1138 getLogger().log("Registering Store " 1139 + storeName 1140 + " (" 1141 + storesClass.get(storeName) 1142 + ") with parameters " 1143 + storesParameters.get(storeName) 1144 + " on scope " + match,LOG_CHANNEL,Logger.INFO); 1145 } 1146 1147 } 1148 1149 1152 private void notifyStoreCreated( String namespaceName, String scope, String storeName ) { 1153 1154 if( createStoreListenerClass != null ) { 1155 try { 1156 Method nsc = createStoreListenerClass.getMethod( 1157 "notifyStoreCreated", new Class []{String .class, String .class, String .class} ); 1158 nsc.invoke( null, new Object []{namespaceName, scope, storeName} ); } 1160 catch( Exception x ) { 1161 Domain.warn( "Notification of store creation "+ 1162 "(namespace="+namespaceName+", scope="+scope+", store="+storeName+") failed: "+x.getMessage() ); 1163 } 1164 } 1165 } 1166 1167 1168 1170 1171 1174 public String toString() { 1175 return getName(); 1176 } 1177 1178 1179} 1180 1181 | Popular Tags |