Package org.jboss.identity.idm.common.exception

Examples of org.jboss.identity.idm.common.exception.IdentityException


         {
            return (LDAPIdentityObjectImpl)findIdentityObject(ctx, io.getName(), io.getIdentityType());
         }
         catch (IdentityException e)
         {
            throw new IdentityException("Provided IdentityObject is not present in the store. Cannot operate on not stored objects.", e);
         }
      }

   }
View Full Code Here


         throw new IllegalArgumentException("IdentityObjectType is null");
      }

      if (!getSupportedFeatures().isIdentityObjectTypeSupported(iot))
      {
         throw new IdentityException("IdentityType not supported by this IdentityStore implementation: " + iot);
      }
   }
View Full Code Here

      {
         ldapContext = (LdapContext)ctx.getIdentityStoreSession().getSessionContext();
      }
      catch (Exception e)
      {
         throw new IdentityException("Could not obtain LDAP connection: ", e);
      }
     
      if (ldapContext == null)
      {
         throw new IdentityException("IllegalState: - Could not obtain LDAP connection");
      }

      return ldapContext;
   }
View Full Code Here

         {
            populateRelationshipTypes(hibernateSession, memberships.toArray(new String[memberships.size()]));
         }
         catch (Exception e)
         {
            throw new IdentityException("Failed to populate relationship types", e);
         }


      }

      if (populateIdentityObjectTypes != null && populateIdentityObjectTypes.equalsIgnoreCase("true"))
      {
         List<String> types = new LinkedList<String>();

         for (IdentityObjectTypeMetaData metaData : configurationMD.getSupportedIdentityTypes())
         {
            types.add(metaData.getName());
         }

         try
         {
            populateObjectTypes(hibernateSession, types.toArray(new String[types.size()]));
         }
         catch (Exception e)
         {
            throw new IdentityException("Failed to populate identity object types", e);
         }

      }

      if (supportedCredentialTypes != null && supportedCredentialTypes.size() > 0)
      {
         try
         {
            populateCredentialTypes(hibernateSession, supportedCredentialTypes.toArray(new String[supportedCredentialTypes.size()]));
         }
         catch (Exception e)
         {
            throw new IdentityException("Failed to populated credential types");
         }
      }

      String realmAware = configurationMD.getOptionSingleValue(IS_REALM_AWARE);
View Full Code Here

         {
            return (SessionFactory)new InitialContext().lookup(sfJNDIName);
         }
         catch (NamingException e)
         {
            throw new IdentityException("Cannot obtain hibernate SessionFactory from provided JNDI name: " + sfJNDIName, e);
         }
      }
      else if (sfRegistryName != null)
      {
         Object registryObject = configurationContext.getConfigurationRegistry().getObject(sfRegistryName);

         if (registryObject == null)
         {
            throw new IdentityException("Cannot obtain hibernate SessionFactory from provided registry name: " + sfRegistryName);
         }

         if (!(registryObject instanceof SessionFactory))
         {
            throw new IdentityException("Cannot obtain hibernate SessionFactory from provided registry name: " + sfRegistryName
            + "; Registered object is not an instance of SessionFactory: " + registryObject.getClass().getName());
         }

         return (SessionFactory)registryObject;


      }
      else if (hibernateConfiguration != null)
      {

         try
         {
            AnnotationConfiguration config = new AnnotationConfiguration().configure(hibernateConfiguration);

            //TODO: make it optional to add annotated classes here

            if (addMappedClasses != null && addMappedClasses.equals("false"))
            {
               return config.buildSessionFactory();
            }
            else
            {

               return config.addAnnotatedClass(HibernateIdentityObject.class)
                  .addAnnotatedClass(HibernateIdentityObjectAttribute.class)
                  .addAnnotatedClass(HibernateIdentityObjectBinaryAttribute.class)
                  .addAnnotatedClass(HibernateIdentityObjectBinaryAttributeValue.class)
                  .addAnnotatedClass(HibernateIdentityObjectTextAttribute.class)
                  .addAnnotatedClass(HibernateIdentityObjectCredential.class)
                  .addAnnotatedClass(HibernateIdentityObjectCredentialType.class)
                  .addAnnotatedClass(HibernateIdentityObjectRelationship.class)
                  .addAnnotatedClass(HibernateIdentityObjectRelationshipName.class)
                  .addAnnotatedClass(HibernateIdentityObjectRelationshipType.class)
                  .addAnnotatedClass(HibernateIdentityObjectType.class)
                  .addAnnotatedClass(HibernateRealm.class).buildSessionFactory();
            }
         }
         catch (Exception e)
         {
            throw new IdentityException("Cannot obtain hibernate SessionFactory using provided hibernate configuration: "+ hibernateConfiguration, e);
         }

      }
      throw new IdentityException("Cannot obtain hibernate SessionFactory. None of supported options specified: "
         + HIBERNATE_SESSION_FACTORY_JNDI_NAME + ", " + HIBERNATE_SESSION_FACTORY_REGISTRY_NAME + ", " + HIBERNATE_CONFIGURATION);


   }
View Full Code Here

      {
         return new HibernateIdentityStoreSessionImpl(sessionFactory);
      }
      catch (Exception e)
      {
         throw new IdentityException("Failed to obtain Hibernate SessionFactory",e);
      }
   }
View Full Code Here

         .setParameter("typeName", identityObjectType.getName())
        .list();

      if (results.size() != 0)
      {
         throw new IdentityException("IdentityObject already present in this IdentityStore:" +
            "name=" + name + "; type=" + identityObjectType.getName() + "; realm=" + realm);
      }

      HibernateIdentityObjectType hibernateType = getHibernateIdentityObjectType(ctx, identityObjectType);

      HibernateIdentityObject io = new HibernateIdentityObject(name, hibernateType, realm);

      if (attributes != null)
      {
         for (Map.Entry<String, String[]> entry : attributes.entrySet())
         {
            io.addTextAttribute(entry.getKey(), entry.getValue());
         }
      }

      try
      {
         getHibernateSession(ctx).persist(io);
      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot persist new IdentityObject" + io, e);
      }


      return io;
   }
View Full Code Here

         hibernateSession.delete(hibernateObject);
      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot remove IdentityObject" + identity, e);
      }
   }
View Full Code Here

            .setParameter("realm", getRealm(hibernateSession, ctx))
            .uniqueResult()).intValue();
      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot count stored IdentityObjects with type: " + identityType.getName(), e);
      }

      return count;
   }
View Full Code Here

               .setParameter("typeName", hibernateType.getName())
               .uniqueResult();
      }
      catch (Exception e)
      {
         throw new IdentityException("Cannot find IdentityObject with name '" + name + "' and type '" + type.getName() + "'", e);
      }

      return hibernateObject;
   }
View Full Code Here

TOP

Related Classes of org.jboss.identity.idm.common.exception.IdentityException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.