public List<CMIReference> getCMIReferences(final String objectName) throws ObjectNotFoundException { synchronized (clusteredObjectsViews) { ClusteredObjectView clusteredObjectView = clusteredObjectsViews.get(objectName); if(clusteredObjectView == null) { throw new ObjectNotFoundException( "Cannot get CMI references", objectName); } return clusteredObjectView.getCMIReferences(); } }
public DistributedObjectInfo getObjectInfo(final String objectName) throws ObjectNotFoundException { synchronized (clusteredObjectsViews) { ClusteredObjectView clusteredObjectView = clusteredObjectsViews.get(objectName); if(clusteredObjectView == null) { throw new ObjectNotFoundException( "Cannot get object infos", objectName); } return clusteredObjectView.getObjectInfo(); } }
public Set<CMIReference> getCMIReferences(final String objectName, final String protocolName) throws ObjectNotFoundException { synchronized (clusteredObjectsViews) { ClusteredObjectView clusteredObjectView = clusteredObjectsViews.get(objectName); if(clusteredObjectView == null) { throw new ObjectNotFoundException( "Cannot get CMI references", objectName); } return clusteredObjectView.getCMIReferences(protocolName); } }
public boolean removeCMIReference(final CMIReference cmiReference) throws ObjectNotFoundException { synchronized (clusteredObjectsViews) { ClusteredObjectView clusteredObjectView = clusteredObjectsViews.get(cmiReference.getObjectName()); if(clusteredObjectView == null) { throw new ObjectNotFoundException( "Cannot get CMI references", cmiReference.getObjectName()); } return clusteredObjectView.removeCMIReference(cmiReference); } }
public boolean isProxyEnabled(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isProxyEnabled(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the name of cluster for the object with the given name. * @param objectName a name of object * @return the name of cluster for a object with the given name * @throws ObjectNotFoundException if none object has the given name */ public String getClusterName(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getClusterName(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return classnames of the application exceptions. * @param objectName a name of object * @return classnames of the application exceptions * @throws ObjectNotFoundException if none object has the given name */ public Set<String> getApplicationExceptionNames(final String objectName) throws ObjectNotFoundException{ try { return clientClusterViewCache.getClusteredObject(objectName).getApplicationExceptionNames(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the interface of an object bound with the given name. * @param objectName a name of object * @return the interface of an object bound with the given name * @throws ObjectNotFoundException if none object has the given name */ public Class<? extends EJBObject> getRemoteClass(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getBusinessClass(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return true if the object with the given name is stateful. * @param objectName a name of object * @return true if the object with the given name is stateful * @throws ObjectNotFoundException if none object has the given name */ public boolean hasState(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isStateful(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Sets a property on policy class of a given object(not object instance). * A property is either a String or a list of String. * @param objectName a name of object * @param propertyName a name of property * @param propertyValue a value for the given name of property * @throws ObjectNotFoundException if the used manager is at client-side */ public void setStaticPropertyForPolicy(final String objectName, final String propertyName, final Object propertyValue) throws ObjectNotFoundException, RuntimeException { DistributedObjectInfo infos = getDistributedObjectInfo(objectName); if (infos == null) { throw new ObjectNotFoundException(objectName + "is not clustered"); } Map<String, Object> properties = infos.getPolicyData().getProperties(); try { synchronized (infos) { properties.remove(propertyName); properties.put(propertyName, propertyValue); setDistributedObjectInfo(objectName, infos); } } catch (Exception e) { new RuntimeException( propertyName + " policy property does not exist for object " + objectName); } }
/** * Returns the interface of an object bound with the given name. * @param objectName a name of object * @return the interface of an object bound with the given name * @throws ObjectNotFoundException if none object has the given name */ public Class<?> getInterface(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getItfClass(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Return true if the object with the given name is replicated for high-availability. * @param objectName a name of object * @return true if the object with the given name is replicated for high-availability * @throws ObjectNotFoundException if none object has the given name */ public boolean isReplicated(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).isReplicated(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns a value property of the policy for an object with the given name. * @param objectName a name of object * @param propertyName a name of property * @return a value property of the policy for an object with the given name * @throws ObjectNotFoundException if none object has the given name */ public Object getPropertyForPolicy(final String objectName, final String propertyName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getProperties().get(propertyName); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns a list of CMIReference for an object with the given name and protocol. * @param objectName a name of object * @param protocolName a name of protocol * @return a list of CMIReference for an object with the given name and protocol * @throws ObjectNotFoundException if none object has the given name for the given protocol */ public List<CMIReference> getCMIReferences(final String objectName, final String protocolName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getCMIReferences(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns a list of CMIReference for an object with the given name and protocol. * The objects deployed on a blacklisted server are discarded. * @param objectName a name of object * @param protocolName a name of protocol * @return a list of CMIReference for an object with the given name and protocol * @throws ObjectNotFoundException if none object has the given name for the given protocol */ public final List<CMIReference> getCMIReferences(final String objectName, final String protocolName) throws ObjectNotFoundException { String objectPath = getObjectPath(objectName); String protoPath = getProtocolPath(objectPath, protocolName); List<CMIReference> cmiReferences = new ArrayList<CMIReference>(); Vector<String> childrenNames = distributedTree .getChildrenNames(protoPath); if (childrenNames.isEmpty()) { LOGGER.error("Unknown object {0} or protocol {1}", objectName, protocolName); throw new ObjectNotFoundException("Unknown object " + objectName + " or protocol " + protocolName); } for (String childrenName : childrenNames) { CMIReference cmiReference = getCMIReference(protoPath, childrenName); cmiReferences.add(cmiReference); } return cmiReferences; }
/** * Returns the properties of the LB policy for an object with the given name. * @param objectName a name of object * @return the properties of the policy for an object with the given name * @throws ObjectNotFoundException if none object has the given name */ public Map<String, Object> getPropertiesForPolicy(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getProperties(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the date of properties for an object with the given name. * @param objectName a name of object * @return the date of properties for an object with the given name * @throws ObjectNotFoundException if none object has the given name */ public long getDateOfProperties(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getDateOfProperties(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns the name of class of strategy for the object with the given name. * @param objectName a name of object * @return the name of class of strategy for the object with the given name * @throws ObjectNotFoundException if none object has the given name */ public String getStrategyClassName(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getStrategyType(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }
/** * Returns informations on this object. * * @param objectName * a name of object * @return informations on this object * @throws ObjectNotFoundException * if the given object is not found */ @Override protected DistributedObjectInfo getDistributedObjectInfo( final String objectName) throws ObjectNotFoundException { String objectPath = getObjectPath(objectName); Object obj = distributedTree.get(objectPath); if (obj == null) { LOGGER.error("Unknown object with name {0}", objectName); throw new ObjectNotFoundException("Unknown object with name " + objectName); } try { return ((DistributedObjectInfo) obj).clone(); } catch (CloneNotSupportedException e) { throw new Error("Amazing bug... I don't believe it !", e); } }
/** * Returns the name of class of policy for the object with the given name. * @param objectName a name of object * @return the name of class of policy for the object with the given name * @throws ObjectNotFoundException if none object has the given name */ public String getPolicyClassName(final String objectName) throws ObjectNotFoundException { try { return clientClusterViewCache.getClusteredObject(objectName).getPolicyData().getPolicyType(); } catch (NullPointerException e) { LOGGER.error("Object is unknown: {0}", objectName); throw new ObjectNotFoundException("Object is unknown: " + objectName); } }