/** * Process the ByteCode attribute */ private EntryAttribute getByteCode( LoadableSchemaObject description, String objectType ) { String byteCodeString = description.getBytecode(); if ( byteCodeString == null ) { String msg = I18n.err( I18n.ERR_10028, objectType, MetaSchemaConstants.M_BYTECODE_AT ); LOG.warn( msg ); throw new NullPointerException( msg ); } byte[] bytecode = Base64.decode( byteCodeString.toCharArray() ); EntryAttribute attr = new DefaultClientAttribute( MetaSchemaConstants.M_BYTECODE_AT, bytecode ); return attr; }
if ( schemaObject.getBytecode() != null ) if ( schemaObject.getBytecode().length() > 16 ) buf.append( schemaObject.getBytecode().substring( 0, 16 ) ); buf.append( schemaObject.getBytecode() );
/** * Returns a String description of a schema. The resulting String format is : * <br> * (OID [DESC '<description>'] FQCN <fcqn> [BYTECODE <bytecode>] X-SCHEMA '<schema>') * <br> * @param description The description to transform to a String * @return */ public static String render( LoadableSchemaObject description ) { StringBuffer buf = new StringBuffer(); buf.append( "( " ).append( description.getOid() ); if ( description.getDescription() != null ) { buf.append( " DESC " ); renderQDString( buf, description.getDescription() ); } buf.append( " FQCN " ).append( description.getFqcn() ); if ( !StringTools.isEmpty( description.getBytecode() ) ) { buf.append( " BYTECODE " ).append( description.getBytecode() ); } buf.append( " X-SCHEMA '" ); buf.append( getSchemaName( description ) ); buf.append( "' )" ); return buf.toString(); }