test_class.declarator: factory
test_class.modifier: private
test_class.original_string: private JcrSessionFactory factory;
test_class.type: JcrSessionFactory
test_class.var_name: factory
test_class.declarator: repository
test_class.modifier: private
test_class.original_string: private Repository repository;
test_class.type: Repository
test_class.var_name: repository
test_class.file: se-jcr-commons/src/test/java/org/springframework/extensions/jcr/JcrSessionFactoryTest.java
test_class.identifier: JcrSessionFactoryTest
test_case.body: @Test
      public void testRegisterNamespaces() throws Exception {
          Properties namespaces = new Properties();
          namespaces.put("foo", "bar");
          namespaces.put("hocus", "pocus");
  
          factory.setNamespaces(namespaces);
  
          Session session = createMock(Session.class);
  
          Workspace workspace = createMock(Workspace.class);
  
          NamespaceRegistry namespaceRegistry = createMock(NamespaceRegistry.class);
  
          // afterPropertiesSet
          expect(repository.login(null, null)).andReturn(session);
          expect(session.getWorkspace()).andReturn(workspace);
          expect(workspace.getNamespaceRegistry()).andReturn(namespaceRegistry);
  
          expect(namespaceRegistry.getPrefixes()).andReturn(new String[0]);
  
          // destroy
          namespaceRegistry.registerNamespace("foo", "bar");
          namespaceRegistry.registerNamespace("hocus", "pocus");
  
          session.logout();
  
          replay(namespaceRegistry, workspace, session, repository);
  
          factory.afterPropertiesSet();
  
          factory.destroy();
  
          verify(namespaceRegistry, workspace, session);
  
      }
test_case.class_method_signature: JcrSessionFactoryTest.testRegisterNamespaces()
test_case.full_signature: @Test public void testRegisterNamespaces()
test_case.identifier: testRegisterNamespaces
test_case.invocations: put put setNamespaces createMock createMock createMock andReturn expect login andReturn expect getWorkspace andReturn expect getNamespaceRegistry andReturn expect getPrefixes registerNamespace registerNamespace logout replay afterPropertiesSet destroy verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRegisterNamespaces()
focal_class.declarator: LOG = LoggerFactory.getLogger(JcrSessionFactory.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(JcrSessionFactory.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: repository
focal_class.modifier: private
focal_class.original_string: private Repository repository;
focal_class.type: Repository
focal_class.var_name: repository
focal_class.declarator: workspaceName
focal_class.modifier: private
focal_class.original_string: private String workspaceName;
focal_class.type: String
focal_class.var_name: workspaceName
focal_class.declarator: credentials
focal_class.modifier: private
focal_class.original_string: private Credentials credentials;
focal_class.type: Credentials
focal_class.var_name: credentials
focal_class.declarator: eventListeners[] = new EventListenerDefinition[] {}
focal_class.modifier: private
focal_class.original_string: private EventListenerDefinition eventListeners[] = new EventListenerDefinition[] {};
focal_class.type: EventListenerDefinition
focal_class.var_name: eventListeners
focal_class.declarator: namespaces
focal_class.modifier: private
focal_class.original_string: private Properties namespaces;
focal_class.type: Properties
focal_class.var_name: namespaces
focal_class.declarator: overwrittenNamespaces
focal_class.modifier: private
focal_class.original_string: private Map<String, String> overwrittenNamespaces;
focal_class.type: Map<String, String>
focal_class.var_name: overwrittenNamespaces
focal_class.declarator: forceNamespacesRegistration = false
focal_class.modifier: private
focal_class.original_string: private boolean forceNamespacesRegistration = false;
focal_class.type: boolean
focal_class.var_name: forceNamespacesRegistration
focal_class.declarator: keepNewNamespaces = true
focal_class.modifier: private
focal_class.original_string: private boolean keepNewNamespaces = true;
focal_class.type: boolean
focal_class.var_name: keepNewNamespaces
focal_class.declarator: skipExistingNamespaces = true
focal_class.modifier: private
focal_class.original_string: private boolean skipExistingNamespaces = true;
focal_class.type: boolean
focal_class.var_name: skipExistingNamespaces
focal_class.declarator: sessionHolderProviderManager
focal_class.modifier: private
focal_class.original_string: private SessionHolderProviderManager sessionHolderProviderManager;
focal_class.type: SessionHolderProviderManager
focal_class.var_name: sessionHolderProviderManager
focal_class.declarator: sessionHolderProvider
focal_class.modifier: private
focal_class.original_string: private SessionHolderProvider sessionHolderProvider;
focal_class.type: SessionHolderProvider
focal_class.var_name: sessionHolderProvider
focal_class.file: se-jcr-commons/src/main/java/org/springframework/extensions/jcr/JcrSessionFactory.java
focal_class.identifier: JcrSessionFactory
focal_class.interfaces: implements InitializingBean, DisposableBean, SessionFactory
focal_class.class_method_signature: JcrSessionFactory.JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials)
focal_class.full_signature: public  JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials)
focal_class.identifier: JcrSessionFactory
focal_class.modifiers: public
focal_class.parameters: (Repository repository, String workspaceName, Credentials credentials)
focal_class.signature:  JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials)
focal_class.class_method_signature: JcrSessionFactory.JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials, SessionHolderProviderManager sessionHolderProviderManager)
focal_class.full_signature: public  JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials, SessionHolderProviderManager sessionHolderProviderManager)
focal_class.identifier: JcrSessionFactory
focal_class.modifiers: public
focal_class.parameters: (Repository repository, String workspaceName, Credentials credentials, SessionHolderProviderManager sessionHolderProviderManager)
focal_class.signature:  JcrSessionFactory(Repository repository, String workspaceName, Credentials credentials, SessionHolderProviderManager sessionHolderProviderManager)
focal_class.class_method_signature: JcrSessionFactory.JcrSessionFactory()
focal_class.full_signature: public  JcrSessionFactory()
focal_class.identifier: JcrSessionFactory
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  JcrSessionFactory()
focal_class.class_method_signature: JcrSessionFactory.afterPropertiesSet()
focal_class.full_signature: @Override public void afterPropertiesSet()
focal_class.identifier: afterPropertiesSet
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void afterPropertiesSet()
focal_class.class_method_signature: JcrSessionFactory.registerNodeTypes()
focal_class.full_signature: protected void registerNodeTypes()
focal_class.identifier: registerNodeTypes
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void registerNodeTypes()
focal_class.class_method_signature: JcrSessionFactory.unregisterNodeTypes()
focal_class.full_signature: protected void unregisterNodeTypes()
focal_class.identifier: unregisterNodeTypes
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void unregisterNodeTypes()
focal_class.class_method_signature: JcrSessionFactory.registerNamespaces()
focal_class.full_signature: protected void registerNamespaces()
focal_class.identifier: registerNamespaces
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void registerNamespaces()
focal_class.class_method_signature: JcrSessionFactory.destroy()
focal_class.full_signature: @Override public void destroy()
focal_class.identifier: destroy
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void destroy()
focal_class.class_method_signature: JcrSessionFactory.unregisterNamespaces()
focal_class.full_signature: protected void unregisterNamespaces()
focal_class.identifier: unregisterNamespaces
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void unregisterNamespaces()
focal_class.class_method_signature: JcrSessionFactory.getBareSession()
focal_class.full_signature: protected Session getBareSession()
focal_class.identifier: getBareSession
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: Session
focal_class.signature: Session getBareSession()
focal_class.class_method_signature: JcrSessionFactory.getSession()
focal_class.full_signature: @Override public Session getSession()
focal_class.identifier: getSession
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: Session
focal_class.signature: Session getSession()
focal_class.class_method_signature: JcrSessionFactory.getSessionHolder(Session session)
focal_class.full_signature: @Override public SessionHolder getSessionHolder(Session session)
focal_class.identifier: getSessionHolder
focal_class.modifiers: @Override public
focal_class.parameters: (Session session)
focal_class.return: SessionHolder
focal_class.signature: SessionHolder getSessionHolder(Session session)
focal_class.class_method_signature: JcrSessionFactory.addListeners(Session session)
focal_class.full_signature: protected Session addListeners(Session session)
focal_class.identifier: addListeners
focal_class.modifiers: protected
focal_class.parameters: (Session session)
focal_class.return: Session
focal_class.signature: Session addListeners(Session session)
focal_class.class_method_signature: JcrSessionFactory.getRepository()
focal_class.full_signature: public Repository getRepository()
focal_class.identifier: getRepository
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Repository
focal_class.signature: Repository getRepository()
focal_class.class_method_signature: JcrSessionFactory.setRepository(Repository repository)
focal_class.full_signature: public void setRepository(Repository repository)
focal_class.identifier: setRepository
focal_class.modifiers: public
focal_class.parameters: (Repository repository)
focal_class.return: void
focal_class.signature: void setRepository(Repository repository)
focal_class.class_method_signature: JcrSessionFactory.setWorkspaceName(String workspaceName)
focal_class.full_signature: public void setWorkspaceName(String workspaceName)
focal_class.identifier: setWorkspaceName
focal_class.modifiers: public
focal_class.parameters: (String workspaceName)
focal_class.return: void
focal_class.signature: void setWorkspaceName(String workspaceName)
focal_class.class_method_signature: JcrSessionFactory.setCredentials(Credentials credentials)
focal_class.full_signature: public void setCredentials(Credentials credentials)
focal_class.identifier: setCredentials
focal_class.modifiers: public
focal_class.parameters: (Credentials credentials)
focal_class.return: void
focal_class.signature: void setCredentials(Credentials credentials)
focal_class.class_method_signature: JcrSessionFactory.equals(Object obj)
focal_class.full_signature: @Override public boolean equals(Object obj)
focal_class.identifier: equals
focal_class.modifiers: @Override public
focal_class.parameters: (Object obj)
focal_class.return: boolean
focal_class.signature: boolean equals(Object obj)
focal_class.class_method_signature: JcrSessionFactory.hashCode()
focal_class.full_signature: @Override public int hashCode()
focal_class.identifier: hashCode
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int hashCode()
focal_class.class_method_signature: JcrSessionFactory.toString()
focal_class.full_signature: @Override public String toString()
focal_class.identifier: toString
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String toString()
focal_class.class_method_signature: JcrSessionFactory.getEventListeners()
focal_class.full_signature: public EventListenerDefinition[] getEventListeners()
focal_class.identifier: getEventListeners
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: EventListenerDefinition[]
focal_class.signature: EventListenerDefinition[] getEventListeners()
focal_class.class_method_signature: JcrSessionFactory.setEventListeners(EventListenerDefinition[] eventListenerDefinitions)
focal_class.full_signature: public void setEventListeners(EventListenerDefinition[] eventListenerDefinitions)
focal_class.identifier: setEventListeners
focal_class.modifiers: public
focal_class.parameters: (EventListenerDefinition[] eventListenerDefinitions)
focal_class.return: void
focal_class.signature: void setEventListeners(EventListenerDefinition[] eventListenerDefinitions)
focal_class.class_method_signature: JcrSessionFactory.getRepositoryInfo()
focal_class.full_signature: private String getRepositoryInfo()
focal_class.identifier: getRepositoryInfo
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getRepositoryInfo()
focal_class.class_method_signature: JcrSessionFactory.getNamespaces()
focal_class.full_signature: public Properties getNamespaces()
focal_class.identifier: getNamespaces
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Properties
focal_class.signature: Properties getNamespaces()
focal_class.class_method_signature: JcrSessionFactory.setNamespaces(Properties namespaces)
focal_class.full_signature: public void setNamespaces(Properties namespaces)
focal_class.identifier: setNamespaces
focal_class.modifiers: public
focal_class.parameters: (Properties namespaces)
focal_class.return: void
focal_class.signature: void setNamespaces(Properties namespaces)
focal_class.class_method_signature: JcrSessionFactory.getSessionHolderProvider()
focal_class.full_signature: protected SessionHolderProvider getSessionHolderProvider()
focal_class.identifier: getSessionHolderProvider
focal_class.modifiers: protected
focal_class.parameters: ()
focal_class.return: SessionHolderProvider
focal_class.signature: SessionHolderProvider getSessionHolderProvider()
focal_class.class_method_signature: JcrSessionFactory.setSessionHolderProvider(SessionHolderProvider sessionHolderProvider)
focal_class.full_signature: protected void setSessionHolderProvider(SessionHolderProvider sessionHolderProvider)
focal_class.identifier: setSessionHolderProvider
focal_class.modifiers: protected
focal_class.parameters: (SessionHolderProvider sessionHolderProvider)
focal_class.return: void
focal_class.signature: void setSessionHolderProvider(SessionHolderProvider sessionHolderProvider)
focal_class.class_method_signature: JcrSessionFactory.getSessionHolderProviderManager()
focal_class.full_signature: public SessionHolderProviderManager getSessionHolderProviderManager()
focal_class.identifier: getSessionHolderProviderManager
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: SessionHolderProviderManager
focal_class.signature: SessionHolderProviderManager getSessionHolderProviderManager()
focal_class.class_method_signature: JcrSessionFactory.setSessionHolderProviderManager(SessionHolderProviderManager sessionHolderProviderManager)
focal_class.full_signature: public void setSessionHolderProviderManager(SessionHolderProviderManager sessionHolderProviderManager)
focal_class.identifier: setSessionHolderProviderManager
focal_class.modifiers: public
focal_class.parameters: (SessionHolderProviderManager sessionHolderProviderManager)
focal_class.return: void
focal_class.signature: void setSessionHolderProviderManager(SessionHolderProviderManager sessionHolderProviderManager)
focal_class.class_method_signature: JcrSessionFactory.setKeepNewNamespaces(boolean keepNamespaces)
focal_class.full_signature: public void setKeepNewNamespaces(boolean keepNamespaces)
focal_class.identifier: setKeepNewNamespaces
focal_class.modifiers: public
focal_class.parameters: (boolean keepNamespaces)
focal_class.return: void
focal_class.signature: void setKeepNewNamespaces(boolean keepNamespaces)
focal_class.class_method_signature: JcrSessionFactory.setForceNamespacesRegistration(boolean forceNamespacesRegistration)
focal_class.full_signature: public void setForceNamespacesRegistration(boolean forceNamespacesRegistration)
focal_class.identifier: setForceNamespacesRegistration
focal_class.modifiers: public
focal_class.parameters: (boolean forceNamespacesRegistration)
focal_class.return: void
focal_class.signature: void setForceNamespacesRegistration(boolean forceNamespacesRegistration)
focal_class.class_method_signature: JcrSessionFactory.setSkipExistingNamespaces(boolean skipRegisteredNamespace)
focal_class.full_signature: public void setSkipExistingNamespaces(boolean skipRegisteredNamespace)
focal_class.identifier: setSkipExistingNamespaces
focal_class.modifiers: public
focal_class.parameters: (boolean skipRegisteredNamespace)
focal_class.return: void
focal_class.signature: void setSkipExistingNamespaces(boolean skipRegisteredNamespace)
focal_class.class_method_signature: JcrSessionFactory.isForceNamespacesRegistration()
focal_class.full_signature: public boolean isForceNamespacesRegistration()
focal_class.identifier: isForceNamespacesRegistration
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isForceNamespacesRegistration()
focal_class.class_method_signature: JcrSessionFactory.isKeepNewNamespaces()
focal_class.full_signature: public boolean isKeepNewNamespaces()
focal_class.identifier: isKeepNewNamespaces
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isKeepNewNamespaces()
focal_class.class_method_signature: JcrSessionFactory.isSkipExistingNamespaces()
focal_class.full_signature: public boolean isSkipExistingNamespaces()
focal_class.identifier: isSkipExistingNamespaces
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: boolean
focal_class.signature: boolean isSkipExistingNamespaces()
focal_class.class_method_signature: JcrSessionFactory.getCredentials()
focal_class.full_signature: public Credentials getCredentials()
focal_class.identifier: getCredentials
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: Credentials
focal_class.signature: Credentials getCredentials()
focal_class.class_method_signature: JcrSessionFactory.getWorkspaceName()
focal_class.full_signature: public String getWorkspaceName()
focal_class.identifier: getWorkspaceName
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getWorkspaceName()
focal_method.body: protected void registerNamespaces() throws Exception {
  
          if (namespaces == null || namespaces.isEmpty())
              return;
  
          if (LOG.isDebugEnabled())
              LOG.debug("registering custom namespaces " + namespaces);
  
          Session session = getBareSession();
          NamespaceRegistry registry = session.getWorkspace().getNamespaceRegistry();
  
          // do the lookup, so we avoid exceptions
          String[] prefixes = registry.getPrefixes();
          // sort the array
          Arrays.sort(prefixes);
  
          // unregister namespaces if told so
          if (forceNamespacesRegistration) {
  
              // save the old namespace only if it makes sense
              if (!keepNewNamespaces)
                  overwrittenNamespaces = new HashMap<String, String>(namespaces.size());
  
              // search occurrences
              for (Object key : namespaces.keySet()) {
                  String prefix = (String) key;
                  int position = Arrays.binarySearch(prefixes, prefix);
                  if (position >= 0) {
                      if (LOG.isDebugEnabled()) {
                          LOG.debug("prefix " + prefix + " was already registered; unregistering it");
                      }
                      if (!keepNewNamespaces) {
                          // save old namespace
                          overwrittenNamespaces.put(prefix, registry.getURI(prefix));
                      }
                      registry.unregisterNamespace(prefix);
                      // postpone registration for later
                  }
              }
          }
  
          // do the registration
          for (Map.Entry<?, ?> entry : namespaces.entrySet()) {
              //            Map.Entry<String, String> namespace = (Map.Entry<String, String>) entry;
              String prefix = (String) entry.getKey();
              String ns = (String) entry.getValue();
  
              int position = Arrays.binarySearch(prefixes, prefix);
  
              if (skipExistingNamespaces && position >= 0) {
                  LOG.debug("namespace already registered under [" + prefix + "]; skipping registration");
              } else {
                  LOG.debug("registering namespace [" + ns + "] under [" + prefix + "]");
                  registry.registerNamespace(prefix, ns);
              }
          }
  
          session.logout();
      }
focal_method.class_method_signature: JcrSessionFactory.registerNamespaces()
focal_method.full_signature: protected void registerNamespaces()
focal_method.identifier: registerNamespaces
focal_method.invocations: isEmpty isDebugEnabled debug getBareSession getNamespaceRegistry getWorkspace getPrefixes sort size keySet binarySearch isDebugEnabled debug put getURI unregisterNamespace entrySet getKey getValue binarySearch debug debug registerNamespace logout
focal_method.modifiers: protected
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void registerNamespaces()