Registers an object in this model identified by a pre existing id.

@param object
The object to register.
@param id
The id by which this object is identified.
773075
public void registerObject(final Object object, final UUID id) {
        objectToId.put(object, id);
        idToObject.put(id, object);
    }
315706
private void registerRenderer(Object object)
	{
		//get the classes to use to render
		Pair<Class<? extends MalisisRenderer<?>>, Class<? extends MalisisRenderer<?>>> rendererClasses = getRendererClasses(object);
		if (rendererClasses == null)
			return;

		//get the block renderer
		MalisisRenderer<?> renderer = null;
		try
		{
			renderer = getRenderer(rendererClasses.getLeft());
		}
		catch (InstantiationException | IllegalAccessException e)
		{
			MalisisCore.log.error(	"[MalisisRegistry] Failed to load {} renderer for {}",
									rendererClasses.getLeft().getSimpleName(),
									object.getClass().getSimpleName(),
									e);
			return;
		}

		//register the block renderer
		if (object instanceof Block && renderer != null)
		{
			blockRenderers.put((Block) object, renderer);
			object = Item.getItemFromBlock((Block) object);
		}

		//get the item renderer
		try
		{
			renderer = getRenderer(rendererClasses.getRight());
		}
		catch (InstantiationException | IllegalAccessException e)
		{
			MalisisCore.log.error(	"[MalisisRegistry] Failed to load {} renderer for {}",
									rendererClasses.getLeft().getSimpleName(),
									object.getClass().getSimpleName());
			return;
		}

		//register the item renderer
		if (object != Items.AIR && renderer != null)
		{
			itemRenderers.put((Item) object, renderer);
		}
	}
466745
public static Object getId(Object object) {
		Objects.nonNull(object);
		try {
			Field idField = getIdField(object.getClass());
			if (idField == null) throw new IllegalArgumentException(object.getClass().getName() + " has no id field to get");
			Object id = idField.get(object);
			return id;
		} catch (SecurityException | IllegalAccessException e) {
			throw new LoggingRuntimeException(e, logger, "getting Id failed");
		}
	}
1227906
public static void addDeepConsoleLogger(Object object)
    {
        addDeepLogger(object, m -> System.out.println(m));
    }
353152
public synchronized boolean registerObject(Object object) {
        if (!MiscUtil.containsInstance(registeredObjects, object)) {
            if (object instanceof IRegisterEvent) {
                IRegisterEvent onRegister = (IRegisterEvent) object;
                onRegisterList.add(onRegister);
                
                for (Object obj : registeredObjects) {
                    onRegister.registerObject(obj);
                }
            }
            
            registeredObjects.add(object);
            
            for (IRegisterEvent onRegister : onRegisterList) {
                onRegister.registerObject(object);
            }
            
            return true;
        }
        
        return false;
    }
82919
@Override
	public final void register( ObjectName name , Object mBean ) throws JMSException
	{
		log.debug("Registering object " + name);
		try
		{
			this.mBeanServer.registerMBean(mBean, name);
		}
		catch (Exception e)
		{
			throw new FFMQException("Cannot register MBean", "JMX_ERROR", e);
		}
	}
139192
public void setId(String id) {
      if (StringUtils.isNullOrBlank(id)) {
         this.id = UUID.randomUUID().toString();
      } else {
         this.id = id;
      }
   }
1306677
private void addObjectIdentity(final Object object) {

        if (object == null) {
            _buffer.append("null");
        } else {
            _buffer.append(object.getClass().getName());
            _buffer.append("@");
            _buffer
                    .append(Integer
                            .toHexString(System.identityHashCode(object)));
        }

    }
276605
public function registerObject($object, $identifier)
    {
        $this->objectMap[$object] = $identifier;
        $this->identifierMap[$identifier] = $object;
    }
705159
public static void register( String name,
                                 Object obj ) {
        register(name, obj, null, null, null, null);
    }
671083
@Override
    public void registerObject(Object object) {
        if (object instanceof ICareWebStartup) {
            startupRoutines.add((ICareWebStartup) object);
        }
    }
396468
public static void setId(Object object, Object id) {
		try {
			Field idField = getIdField(object.getClass());
			if (idField != null) {
				idField.set(object, id);
			}
		} catch (IllegalAccessException | IllegalArgumentException e) {
			throw new LoggingRuntimeException(e, logger, "setting Id failed");
		}
	}
188327
public static void register(FastProtocolId id, Method m) {
    synchronized (FastProtocolRegister.class) {
      String name = id.toString();
      if (name.length() != NAME_LEN) {
        // we only allow two-byte serialization codes
        throw new RuntimeException("Code must be " + NAME_LEN + " bytes long");
      }
      if (m == null) {
        throw new RuntimeException("Method cannot be null");
      }
      Method registeredMethod = idToMethod.get(name);
      if (registeredMethod != null && registeredMethod != m) {
        throw new RuntimeException(
            "Trying to register different method with name: " + name);
      } else if (registeredMethod == m) {
        return; // quietly
      }
      LOG.info("FastProtocol - Registering method: " + name + " method: "
          + m.getName());
      idToMethod.put(name, m);
      methodToId.put(m, name);
    }
  }
1046535
public void cache(Identity oid, Object obj)
    {
        if (oid != null && obj != null)
        {
            ObjectCache cache = getCache(oid, obj, METHOD_CACHE);
            if (cache != null)
            {
                cache.cache(oid, obj);
            }
        }
    }
1001513
public synchronized boolean unregisterObject(Object object) {
        int i = MiscUtil.indexOfInstance(registeredObjects, object);
        
        if (i > -1) {
            registeredObjects.remove(i);
            
            for (IRegisterEvent onRegister : onRegisterList) {
                onRegister.unregisterObject(object);
            }
            
            if (object instanceof IRegisterEvent) {
                onRegisterList.remove(object);
            }
            
            return true;
        }
        
        return false;
    }
622080
private void registerObject(DigitalObject obj)
            throws StorageDeviceException {
        String pid = obj.getPid();
        String userId = "the userID field is no longer used";
        String label = "the label field is no longer used";

        Connection conn = null;
        PreparedStatement s1 = null;
        try {
            String query =
                    "INSERT INTO doRegistry (doPID, ownerId, label) VALUES (?, ?, ?)";
            conn = m_connectionPool.getReadWriteConnection();
            s1 = conn.prepareStatement(query);
            s1.setString(1,pid);
            s1.setString(2,userId);
            s1.setString(3, label);
            s1.executeUpdate();

            if (obj.hasContentModel(Models.SERVICE_DEPLOYMENT_3_0)){
                updateDeploymentMap(obj, conn);
            }
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
                    + sqle.getMessage(), sqle);
        } finally {
            try {
                if (s1 != null) {
                    s1.close();
                }
            } catch (Exception sqle) {
                throw new StorageDeviceException("Unexpected error from SQL database while registering object: "
                        + sqle.getMessage(), sqle);
            } finally {
                s1 = null;
            }
        }

        PreparedStatement s2 = null;
        ResultSet results = null;
        try {
            // REGISTRY:
            // update systemVersion in doRegistry (add one)
            logger.debug("COMMIT: Updating registry...");
            String query =
                    "SELECT systemVersion FROM doRegistry WHERE doPID=?";
            s2 = conn.prepareStatement(query);
            s2.setString(1, pid);
            results = s2.executeQuery();
            if (!results.next()) {
                throw new ObjectNotFoundException("Error creating replication job: The requested object doesn't exist in the registry.");
            }
            int systemVersion = results.getInt("systemVersion");
            systemVersion++;
            query = "UPDATE doRegistry SET systemVersion=? WHERE doPID=?";
            s2.close();
            s2 = conn.prepareStatement(query);
            s2.setInt(1, systemVersion);
            s2.setString(2,pid);
            s2.executeUpdate();
        } catch (SQLException sqle) {
            throw new StorageDeviceException("Error creating replication job: "
                    + sqle.getMessage());
        } catch (ObjectNotFoundException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            try {
                if (results != null) {
                    results.close();
                }
                if (s2 != null) {
                    s2.close();
                }
                if (conn != null) {
                    m_connectionPool.free(conn);
                }
            } catch (SQLException sqle) {
                throw new StorageDeviceException("Unexpected error from SQL database: "
                        + sqle.getMessage());
            } finally {
                results = null;
                s2 = null;
            }
        }
    }
1060252
public function register($nickname, $object)
    {
        if (isset($this->autoInstantiations[$nickname]))
        {
            throw new DuplicateObjectException($nickname);
        }

        $this->autoInstantiations[$nickname] = $object;
    }