public Builder mergeFrom(org.drools.marshalling.impl.ProtobufMessages.Header other) { if (other == org.drools.marshalling.impl.ProtobufMessages.Header.getDefaultInstance()) return this; if (other.hasVersion()) { mergeVersion(other.getVersion()); if (other.hasSignature()) { mergeSignature(other.getSignature()); if (other.hasPayload()) { setPayload(other.getPayload()); this.mergeUnknownFields(other.getUnknownFields()); return this;
public org.drools.marshalling.impl.ProtobufMessages.Header buildPartial() { org.drools.marshalling.impl.ProtobufMessages.Header result = new org.drools.marshalling.impl.ProtobufMessages.Header(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0;
public int getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(1, version_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(4, signature_); } for (int i = 0; i < strategy_.size(); i++) { size += com.google.protobuf.CodedOutputStream .computeMessageSize(9, strategy_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(10, payload_); } size += extensionsSerializedSize(); size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; }
private static void checkSignature(Header _header, byte[] sessionbuff) { KeyStoreHelper helper = new KeyStoreHelper(); boolean signed = _header.hasSignature(); if ( helper.isSigned() != signed ) { throw new RuntimeDroolsException( "This environment is configured to work with " + if ( !helper.checkDataWithPublicKey( _header.getSignature().getKeyAlias(), sessionbuff, _header.getSignature().getSignature().toByteArray() ) ) { throw new RuntimeDroolsException( "Signature does not match serialized package. This is a security violation. Deserialisation aborted." );
Variable parseFrom = JBPMMessages.Variable.parseFrom(_header.getPayload(), registry); Object value = ProtobufProcessMarshaller.unmarshallVariableValue(context, parseFrom);
private static void loadStrategiesIndex(MarshallerReaderContext context, ProtobufMessages.Header _header) throws IOException, ClassNotFoundException { for ( ProtobufMessages.Header.StrategyIndex _entry : _header.getStrategyList() ) { ObjectMarshallingStrategy strategyObject = context.resolverStrategyFactory.getStrategyObject( _entry.getName() ); if ( strategyObject == null ) { throw new IllegalStateException( "No strategy of type " + _entry.getName() + " available." ); } context.usedStrategies.put( _entry.getId(), strategyObject ); Context ctx = strategyObject.createContext(); context.strategyContexts.put( strategyObject, ctx ); if( _entry.hasData() && ctx != null ) { ClassLoader classLoader = null; if (context.classLoader != null ){ classLoader = context.classLoader; } else if(context.ruleBase != null){ classLoader = context.ruleBase.getRootClassLoader(); } ctx.read( new DroolsObjectInputStream( _entry.getData().newInput(), classLoader) ); } } }
public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); com.google.protobuf.GeneratedMessage .ExtendableMessage<org.drools.marshalling.impl.ProtobufMessages.Header>.ExtensionWriter extensionWriter = newExtensionWriter(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeMessage(1, version_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeMessage(4, signature_); } for (int i = 0; i < strategy_.size(); i++) { output.writeMessage(9, strategy_.get(i)); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(10, payload_); } extensionWriter.writeUntil(200, output); getUnknownFields().writeTo(output); }
public org.drools.marshalling.impl.ProtobufMessages.Header getDefaultInstanceForType() { return org.drools.marshalling.impl.ProtobufMessages.Header.getDefaultInstance(); }
/** * <code>optional bytes payload = 10;</code> * * <pre> * byte blobs * </pre> */ public Builder clearPayload() { bitField0_ = (bitField0_ & ~0x00000008); payload_ = getDefaultInstance().getPayload(); onChanged(); return this; }
public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!extensionsAreInitialized()) { memoizedIsInitialized = 0; return false; } memoizedIsInitialized = 1; return true; }
private static ProtobufMessages.Header loadStrategiesCheckSignature(MarshallerReaderContext context, ProtobufMessages.Header _header) throws ClassNotFoundException, IOException { loadStrategiesIndex( context, _header ); byte[] sessionbuff = _header.getPayload().toByteArray(); // should we check version as well here? checkSignature( _header, sessionbuff ); return _header; }
private static ProtobufMessages.KnowledgeSession loadAndParseSession(MarshallerReaderContext context) throws IOException, ClassNotFoundException { ExtensionRegistry registry = PersisterHelper.buildRegistry( context, processMarshaller ); ProtobufMessages.Header _header = PersisterHelper.readFromStreamWithHeaderPreloaded(context, registry); return ProtobufMessages.KnowledgeSession.parseFrom( _header.getPayload(), registry ); }