/** * Activation constructor * * @param activationID activation ID passed in by the activation daemon. * @param data state data needed to re-activate a Mercury server */ MailboxImpl(ActivationID activationID, MarshalledObject data) throws Exception { this((String[]) new MarshalledInstance(data).get(false), activationID, true, new Object[] {activationID, data} ); }
/** Set the reference to the client-supplied notification target */ public synchronized void setEventTarget(RemoteEventListener preparedTarget) throws IOException { if (preparedTarget == null) { preparedEventTarget = null; marshalledEventTarget = null; } else { preparedEventTarget = preparedTarget; marshalledEventTarget = new MarshalledInstance(preparedTarget).convertToMarshalledObject(); } }
/** * Returns <code>true</code> if the two input objects are the same in * <code>MarshalledInstance</code> form, <code>false</code> otherwise. */ private static boolean equal(Object o1, Object o2) { if (o1 == o2) return true; if (o1 == null || o2 == null) return false; Class c = o1.getClass(); if (c == String.class || c == Integer.class || c == Boolean.class || c == Character.class || c == Long.class || c == Float.class || c == Double.class || c == Byte.class || c == Short.class) return o1.equals(o2); try { return new MarshalledInstance(o1).equals(new MarshalledInstance(o2)); } catch (IOException ex) { throw new IllegalArgumentException("unexpected IOException"); } }
public Object resolve( CodebaseAccessor bootstrapProxy, MarshalledInstance smartProxy, ClassLoader parentLoader, ClassLoader verifierLoader, Collection context) throws IOException, ClassNotFoundException { return smartProxy.get(parentLoader, true, verifierLoader, context); }
/** * Creates a new <code>MarshalledWrapper</code> wrapping a * <code>MarshalledInstance</code> containing the given object. * * @param obj object to create <code>MarshalledInstance</code> with * @throws IOException if <code>MarshalledInstance</code> creation fails */ public MarshalledWrapper(Object obj) throws IOException { instance = new MarshalledInstance(obj); }
/** * Convenience method that performs a byte-wise comparison, including codebases, of the * services referenced by the given service items, and returns the result. If the services * cannot be compared, it is assumed that the versions are not the same, and * <code>false</code> is returned. */ private boolean sameVersion(ServiceItem item0, ServiceItem item1) { if (item0.service instanceof SameProxyVersionProvider && item1.service instanceof SameProxyVersionProvider) { Object version0 = ((SameProxyVersionProvider) item0.service).getVersion(); Object version1 = ((SameProxyVersionProvider) item1.service).getVersion(); if (version0 != null && version1 != null) { return version0.equals(version1); } } boolean fullyEqual = false; try { MarshalledInstance mi0 = new MarshalledInstance(item0.service); MarshalledInstance mi1 = new MarshalledInstance(item1.service); fullyEqual = mi0.fullyEquals(mi1); } catch (IOException e) { logger.log(Level.INFO, "failure marshalling old and new " + "services for equality check", e); } return fullyEqual; }//end LookupCacheImpl.sameVersion
Object readResolve() throws ObjectStreamException { return instance.convertToMarshalledObject(); } }
/** * Compares this <code>MarshalledInstance</code> to another object. Returns true if and only if * the argument refers to an instance of <code>MarshalledInstance</code> that contains exactly * the same serialized form for its contained object as this object does and has the same class * codebase annotations. * * @param obj the object to compare with this <code>MarshalledInstance</code> * @return <code>true</code> if the argument contains an object with an equivalent serialized * form and codebase; otherwise returns <code>false</code> */ public boolean fullyEquals(Object obj) { if (equals(obj)) { MarshalledInstance other = (MarshalledInstance) obj; return Arrays.equals(locBytes, other.locBytes); } return false; }
/** * Returns the hash code value for this <code>MarshalledWrapper</code>. * * @return the hash code value for this <code>MarshalledWrapper</code>. */ public int hashCode() { return MarshalledWrapper.class.hashCode() ^ instance.hashCode(); }
/** * Returns the result of calling the {@link MarshalledInstance#get(boolean) get} method of the * wrapped <code>MarshalledInstance</code>, passing the integrity value sampled during * deserialization as the <code>verifyCodebaseIntegrity</code> argument. If this * <code>MarshalledWrapper</code> instance was not produced by deserialization or was * deserialized from a stream with no integrity protection setting, then a * <code>verifyCodebaseIntegrity</code> value of <code>false</code> is used. * * @return the object unmarshalled by the wrapped <code>MarshalledInstance</code> * @throws IOException if an <code>IOException</code> occurs during unmarshalling * @throws ClassNotFoundException if any classes necessary for reconstructing the object being * unmarshalled cannot be found */ public Object get() throws IOException, ClassNotFoundException { return instance.get(integrity); }
MarshalledObjectSerializer(MarshalledObject obj){ this(new MarshalledInstance(obj)); }
service1 = ((RemoteMethodControl) service1).setConstraints(constraints); MarshalledInstance mi0 = new MarshalledInstance(service0); MarshalledInstance mi1 = new MarshalledInstance(service1); fullyEqual = mi0.fullyEquals(mi1); } catch (IOException e) { if (ServiceDiscoveryManager.logger.isLoggable(Level.INFO)){
/** * Returns the handback object that was provided as a parameter to * the event interest registration method, if any. * * @return the MarshalledObject that was provided as a parameter to * the event interest registration method, if any. * @deprecated Use {@link #getRegistrationInstance() } instead. */ @Deprecated public MarshalledObject getRegistrationObject() { if (handback == null && miHandback != null) return miHandback.convertToMarshalledObject(); return handback; }
/** * Compares this <code>MarshalledInstance</code> to another * object. Returns true if and only if the argument refers to an instance * of <code>MarshalledInstance</code> that contains exactly the same * serialized form for its contained object as this object does and * has the same class codebase annotations. * * @param obj the object to compare with this * <code>MarshalledInstance</code> * @return <code>true</code> if the argument contains an object * with an equivalent serialized form and codebase; * otherwise returns <code>false</code> */ public boolean fullyEquals(Object obj) { if (equals(obj)) { MarshalledInstance other = (MarshalledInstance)obj; return Arrays.equals(locBytes, other.locBytes); } return false; }
/** * Returns the hash code value for this <code>MarshalledWrapper</code>. * * @return the hash code value for this <code>MarshalledWrapper</code>. */ public int hashCode() { return MarshalledWrapper.class.hashCode() ^ instance.hashCode(); }
@Override public void read(ObjectInput stream) throws IOException, ClassNotFoundException { MarshalledObject mo = (MarshalledObject)stream.readObject(); try { source = new MarshalledInstance(mo).get(false); } catch (Throwable e) { if (e instanceof Error && !(e instanceof LinkageError || e instanceof OutOfMemoryError || e instanceof StackOverflowError)) { throw (Error)e; } } }
/** * @serialData RemoteEventListener as a MarshalledObject */ private void writeObject(ObjectOutputStream stream) throws IOException { stream.defaultWriteObject(); stream.writeObject(new MarshalledInstance(target).convertToMarshalledObject()); }
/** * Returns the result of calling the {@link MarshalledInstance#get(boolean) * get} method of the wrapped <code>MarshalledInstance</code>, passing the * integrity value sampled during deserialization as the * <code>verifyCodebaseIntegrity</code> argument. If this * <code>MarshalledWrapper</code> instance was not produced by * deserialization or was deserialized from a stream with no integrity * protection setting, then a <code>verifyCodebaseIntegrity</code> value of * <code>false</code> is used. * * @return the object unmarshalled by the wrapped * <code>MarshalledInstance</code> * @throws IOException if an <code>IOException</code> occurs during * unmarshalling * @throws ClassNotFoundException if any classes necessary for * reconstructing the object being unmarshalled cannot be found */ public Object get() throws IOException, ClassNotFoundException { return instance.get(integrity); }
/** * Returns the handback object that was provided as a parameter to * the event interest registration method, if any. Note that if the * handback object was a MarshalledObject, it will be returned as a * MarshalledInstance. * * @return the MarshalledInstance that was provided as a parameter to * the event interest registration method, if any. * Or the MarshalledObject that was provided, converted to a * MarshalledInstance. */ public MarshalledInstance getRegistrationInstance() { if ( miHandback == null && handback != null) return new MarshalledInstance(handback); return miHandback; }
/** * Compares the specified object with this <code>MarshalledWrapper</code> * for equality. This method returns <code>true</code> if and only if the * specified object is of the same class as this object and its wrapped * <code>MarshalledInstance</code> is equal to the one in this object. * * @param obj object to compare with * @return <code>true</code> if <code>obj</code> is equivalent to * this object; <code>false</code> otherwise */ public boolean equals(Object obj) { return obj == this || (obj != null && obj.getClass() == getClass() && instance.equals(((MarshalledWrapper) obj).instance)); }