Reads the management bean and extracts monitored data on regular base.
325014
private void readMbean() {
        int i = 0;
        for (GarbageCollectorMXBean bean : mxBeans) {
            GCStats stat = (GCStats) iStatsList.get(i);
            stat.update(bean.getCollectionCount(), bean.getCollectionTime());
            i++;
        }
    }
690096
protected <T> ManagedObjectFactory<T> getManagedBeanManagedObjectFactory(BeanMetaData bmd, Class<T> klass) throws EJBConfigurationException {
        ManagedObjectFactory<T> factory = null;
        ManagedObjectService managedObjectService = getManagedObjectService();
        if (managedObjectService != null) {
            try {
                factory = managedObjectService.createManagedObjectFactory(bmd._moduleMetaData, klass, true);
                //TODO the isManaged method could be moved to the ManagedObjectService and then wouldn't need to create the factory
                if (!factory.isManaged()) {
                    factory = null;
                }
            } catch (ManagedObjectException e) {
                throw new EJBConfigurationException(e);
            }
        }

        return factory;
    }
922348
public void readObject(java.io.DataInputStream dataInputStream,
                           ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "readObject";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this,
                        cclass,
                        methodName,
                        new Object[] { dataInputStream, objectManagerState });

        try {
            byte version = dataInputStream.readByte();
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this, cclass,
                            methodName,
                            "version=" + version + "(byte)");

            identifier = dataInputStream.readLong();
            int XIDLength = dataInputStream.readUnsignedByte();
            if (XIDLength > 0)
            {
                XID = new byte[XIDLength];
                dataInputStream.read(XID);
            } // if (XIDLength > 0).

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:217:1.9");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass,
                           methodName,
                           "via PermanentIOException");
            throw new PermanentIOException(this,
                                           exception);
        } // catch (java.io.IOException exception).

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this,
                       cclass,
                       methodName);
    }
683901
@Override
    public boolean parseManagementInterfaces(final XMLExtendedStreamReader reader, final ModelNode address,
            final List<ModelNode> list) throws XMLStreamException {
        requireNoAttributes(reader);

        while (reader.hasNext() && reader.nextTag() != END_ELEMENT) {
            requireNamespace(reader, namespace);
            final Element element = Element.forName(reader.getLocalName());
            switch (element) {
                case NATIVE_INTERFACE: {
                    parseManagementInterface(reader, address, false, list);
                    break;
                }
                case HTTP_INTERFACE: {
                    parseManagementInterface(reader, address, true, list);
                    break;
                }
                case NATIVE_REMOTING_INTERFACE: {
                    parseNativeRemotingManagementInterface(reader, address, list);
                    break;
                }
                default: {
                    throw unexpectedElement(reader);
                }
            }
        }

        return true;
    }
963216
public static void writeTraceBeanMetaData(BeanMetaData bmd,
                                              int dtdVersion)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
        {
            StringBuffer sbuf = new StringBuffer();

            sbuf
                            .append(BMD_Type_Str).append(DataDelimiter)
                            .append(BMD_Type).append(DataDelimiter)
                            .append(dtdVersion).append(DataDelimiter)
                            .append(bmd.j2eeName).append(DataDelimiter)
                            .append(bmd.simpleJndiBindingName).append(DataDelimiter);

            if (bmd.type == InternalConstants.TYPE_STATELESS_SESSION) {

                sbuf
                                .append("Stateless")
                                .append(" Session Bean").append(DataDelimiter);
                if (bmd.usesBeanManagedTx) {
                    sbuf.append("BMT").append(DataDelimiter);
                } else {
                    sbuf.append("CMT").append(DataDelimiter);
                }
                sbuf.append("N/A").append(DataDelimiter); // dxxxxxx

            } else if (bmd.type == InternalConstants.TYPE_STATEFUL_SESSION) {

                sbuf
                                .append("Stateful")
                                .append(" Session Bean").append(DataDelimiter);
                if (bmd.usesBeanManagedTx) {
                    sbuf.append("BMT").append(DataDelimiter);
                } else {
                    sbuf.append("CMT").append(DataDelimiter);
                }
                sbuf.append("N/A").append(DataDelimiter);

            } else if (bmd.type == InternalConstants.TYPE_SINGLETON_SESSION) { //F743-508.CodRev

                sbuf
                                .append("Singleton")
                                .append(" Session Bean").append(DataDelimiter);
                if (bmd.usesBeanManagedTx) {
                    sbuf.append("BMT").append(DataDelimiter);
                } else {
                    sbuf.append("CMT").append(DataDelimiter);
                }
                sbuf.append("N/A").append(DataDelimiter);

            } else if (bmd.type == InternalConstants.TYPE_BEAN_MANAGED_ENTITY) {

                sbuf
                                .append("BMP")
                                .append(" Entity Bean").append(DataDelimiter)
                                .append("CMT").append(DataDelimiter)
                                .append("N/A").append(DataDelimiter);

            } else if (bmd.type == InternalConstants.TYPE_CONTAINER_MANAGED_ENTITY) {

                sbuf
                                .append("CMP")
                                .append(" Entity Bean").append(DataDelimiter)
                                .append("CMT").append(DataDelimiter);
                int cmpV = bmd.getCMPVersion();
                sbuf.append(cmpV).append(".x").append(DataDelimiter);

            } else if (bmd.type == InternalConstants.TYPE_MESSAGE_DRIVEN) {
                sbuf.append("Message Driven Bean").append(DataDelimiter);
                if (bmd.usesBeanManagedTx) {
                    sbuf.append("BMT").append(DataDelimiter);
                } else {
                    sbuf.append("CMT").append(DataDelimiter);
                }
                sbuf.append("N/A").append(DataDelimiter);
            }

            sbuf
                            .append(turnNullClass2EmptyString(bmd.homeInterfaceClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.remoteInterfaceClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.remoteImplClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.homeRemoteImplClass)).append(DataDelimiter)

                            .append(turnNullClass2EmptyString(bmd.localHomeInterfaceClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.localInterfaceClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.localImplClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.homeLocalImplClass)).append(DataDelimiter);

            sbuf
                            .append(turnNullClass2EmptyString(bmd.homeBeanClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.enterpriseBeanClass)).append(DataDelimiter)
                            .append(turnNullClass2EmptyString(bmd.enterpriseBeanAbstractClass)).append(DataDelimiter)

                            .append(turnNullClass2EmptyString(bmd.pKeyClass)).append(DataDelimiter)

                            .append(bmd.minPoolSize).append(DataDelimiter)
                            .append(bmd.maxPoolSize).append(DataDelimiter)
                            .append(bmd.reentrant).append(DataDelimiter)
                            .append(bmd.sessionTimeout).append(DataDelimiter)
                            .append(bmd.isPreFindFlushEnabled).append(DataDelimiter)
                            .append(bmd.optionACommitOption ? "A"
                                            : bmd.optionBCommitOption ? "B"
                                                            : bmd.optionCCommitOption ? "C"
                                                                            : "Unknown").append(DataDelimiter);

            writeMethodInfo(sbuf, bmd.methodInfos);
            writeMethodInfo(sbuf, bmd.localMethodInfos);
            writeMethodInfo(sbuf, bmd.homeMethodInfos);
            writeMethodInfo(sbuf, bmd.localHomeMethodInfos);

            ResourceRefConfigList resRefList = bmd._resourceRefList;
            int resourcesDefined = resRefList.size();
            sbuf.append(resourcesDefined).append(DataDelimiter);
            for (int i = 0; i < resourcesDefined; ++i)
            {
                ResourceRefConfig resRef = resRefList.getResourceRefConfig(i);
                sbuf
                                .append(turnNullString2EmptyString(resRef.getName())).append(DataDelimiter)
                                .append(turnNullString2EmptyString(resRef.getDescription())).append(DataDelimiter)
                                .append(turnNullString2EmptyString(resRef.getJNDIName())).append(DataDelimiter)
                                .append(turnNullString2EmptyString(resRef.getType())).append(DataDelimiter)
                                .append(resRef.getIsolationLevel()).append(DataDelimiter)
                                .append(resRef.getSharingScope()).append(DataDelimiter)
                                .append(resRef.getAuth()).append(DataDelimiter);
            }
            // d214462 Begins
            // EJB 2.1 - TimedObject           d174057.3
            sbuf.append((dtdVersion >= BeanMetaData.J2EE_EJB_VERSION_2_1 && bmd.isTimedObject)).append(DataDelimiter);

            // MDB 2.0/2.1 and greater ActivationSpec/MessageDestination    LI2110-46
            sbuf
                            .append(turnNullString2EmptyString(bmd.ivActivationSpecJndiName)).append(DataDelimiter)
                            .append(turnNullString2EmptyString(bmd.ivMessageDestinationJndiName)).append(DataDelimiter);

            writeMethodInfo(sbuf, bmd.timedMethodInfos);
            writeMethodInfo(sbuf, bmd.wsEndpointMethodInfos);

            // EJB 2.1 - WebService Endpoint Interface / Wrapper       d174057.3
            sbuf.append(turnNullClass2EmptyString(bmd.webserviceEndpointInterfaceClass)).append(DataDelimiter);

            /**** N O T E S ****/
            // All new metadata MUST append to the sbuf to maintain backward compatibility

            //          sbuf.append( turnNullClass2EmptyString( bmd.webserviceWrapperClass ) ).append( DataDelimiter )

            // d214462 Ends
            Tr.debug(tc, sbuf.toString());
        }
    }
513502
def main(dbfile, pidfile, mode):
    '''
    
    '''
    Inspector(dbfile, pidfile).reuse_snapshot().snapshot(mode)
96448
@Bean
	public SpringDataSourceBeanPostProcessor monitoringDataSourceBeanPostProcessor(
			@Value("${javamelody.excluded-datasources:}") String excludedDatasources) {
		// IMPORTANT: We cannot inject JavaMelodyConfigurationProperties here because of bean load order! Therefore we have
		// to use that rather dirty way to inject the configuration value.
		final SpringDataSourceBeanPostProcessor processor = new SpringDataSourceBeanPostProcessor();
		if (excludedDatasources != null && excludedDatasources.trim().length() > 0) {
			processor.setExcludedDatasources(
					new HashSet<>(Arrays.asList(excludedDatasources.split(","))));
		}
		return processor;
	}
1195005
public static BeanManager getBeanManager() {
        BeanManager mgr = getBeanManagerFromJndi();
        if (mgr == null) {
            ServiceLoader<BeanManagerProvider> loader = ServiceLoader
                .load(BeanManagerProvider.class);
            Iterator<BeanManagerProvider> it = loader.iterator();

            while (mgr == null && it.hasNext()) {
                BeanManagerProvider provider = it.next();
                mgr = provider.getBeanManager();
            }
        }

        return mgr;
    }
14456
public static Method getReadMethod(Object bean, String name) {
		return getReadMethods(bean).get(name);
	}
755304
public List<TableMeta> read() {
    Connection con = JdbcUtil.getConnection(dataSource);
    try {
      DatabaseMetaData metaData = con.getMetaData();
      List<TableMeta> tableMetas =
          getTableMetas(metaData, schemaName != null ? schemaName : getDefaultSchemaName(metaData));
      for (TableMeta tableMeta : tableMetas) {
        Set<String> primaryKeySet = getPrimaryKeys(metaData, tableMeta);
        handleColumnMeta(metaData, tableMeta, primaryKeySet);
      }
      if (dialect.isJdbcCommentUnavailable()) {
        readCommentFromDictinary(con, tableMetas);
      }
      return tableMetas;
    } catch (SQLException e) {
      throw new GenException(Message.DOMAGEN9001, e, e);
    } finally {
      JdbcUtil.close(con);
    }
  }
1335221
public static BeanManager getBeanManager(Object ctx) {
        return (BeanManager) javax.portlet.PortletContext.class.cast(ctx).getAttribute(WeldServletLifecycle.BEAN_MANAGER_ATTRIBUTE_NAME);
    }
279614
private void readResources(ResourceMap hmResourcesRules) throws ResourceInitializationException {
		Pattern paReadRules = Pattern.compile("RULENAME=\"(.*?)\",EXTRACTION=\"(.*?)\",NORM_VALUE=\"(.*?)\"(.*)");
		Pattern paVariable = Pattern.compile("%(re[a-zA-Z0-9]*)");
		
		// read normalization data
		InputStream is = null;
		InputStreamReader isr = null;
		BufferedReader br = null;
		try {
			for (String resource : hmResourcesRules.keySet()) {
				is = hmResourcesRules.getInputStream(resource);
				isr = new InputStreamReader(is, "UTF-8");
				br = new BufferedReader(isr);
				Logger.printDetail(component, "Adding rule resource: " + resource);
				for(String line; (line = br.readLine()) != null; ) {
					if(line.startsWith("//") || line.equals("")) {
						continue;
					}
					
					Logger.printDetail("DEBUGGING: reading rules..."+ line);
					// check each line for the name, extraction, and normalization part
					for (MatchResult r : Toolbox.findMatches(paReadRules, line)) {
						String rule_name          = r.group(1);
						String rule_extraction    = r.group(2);
						String rule_normalization = r.group(3);
						
						////////////////////////////////////////////////////////////////////
						// RULE EXTRACTION PARTS ARE TRANSLATED INTO REGULAR EXPRESSSIONS //
						////////////////////////////////////////////////////////////////////
						// create pattern for rule extraction part
						RePatternManager rpm = RePatternManager.getInstance(language, false);
						for (MatchResult mr : Toolbox.findMatches(paVariable,rule_extraction)) {
							Logger.printDetail("DEBUGGING: replacing patterns..."+ mr.group());
							if (!(rpm.containsKey(mr.group(1)))) {
								Logger.printError("Error creating rule:"+rule_name);
								Logger.printError("The following pattern used in this rule does not exist, does it? %"+mr.group(1));
								System.exit(-1);
							}
							rule_extraction = rule_extraction.replaceAll("%"+mr.group(1), rpm.get(mr.group(1)));
						}
						rule_extraction = rule_extraction.replaceAll(" ", "[\\\\s]+");
						Pattern pattern = null;
						try{
							pattern = Pattern.compile(rule_extraction);
						}
						catch (java.util.regex.PatternSyntaxException e) {
							Logger.printError("Compiling rules resulted in errors.");
							Logger.printError("Problematic rule is "+rule_name);
							Logger.printError("Cannot compile pattern: "+rule_extraction);
							e.printStackTrace();
							System.exit(-1);
						}
						
						/////////////////////////////////////////////////
						// READ INTERVAL RULES AND MAKE THEM AVAILABLE //
						/////////////////////////////////////////////////
						if(resource.equals("intervalrules")){
							hmIntervalPattern.put(pattern,rule_name);
							hmIntervalNormalization.put(rule_name, rule_normalization);
						}
					}
				}
			}
		} catch (IOException e) {
			e.printStackTrace();
			throw new ResourceInitializationException();
		} finally {
			try {
				if(br != null) {
					br.close();
				}
				if(isr != null) {
					isr.close();
				}
				if(is != null) {
					is.close();
				}
			} catch(Exception e) {
				e.printStackTrace();
			}
		}
	}
863096
def _reads_in_peaks(bam_file, peaks_file, sample):
    """"""
    if not peaks_file:
        return {}
    rip = number_of_mapped_reads(sample, bam_file, bed_file = peaks_file)
    return {"metrics": {"RiP": rip}}
1246100
private void readPropertiesFiles() {

        if (this.messageFileWildcard.isEmpty() || !CoreParameters.LOG_RESOLUTION.get()) {
            // Skip configuration loading
            LOGGER.info(JRebirthMarkers.MESSAGE, "Messages Loading is skipped");

        } else {
            // Assemble the regex pattern
            final Pattern filePattern = Pattern.compile(this.messageFileWildcard + "\\.properties");

            // Retrieve all resources from default classpath
            final Collection<String> list = ClasspathUtility.getClasspathResources(filePattern);

            LOGGER.info(JRebirthMarkers.MESSAGE, "{} Messages file{} found.", list.size(), list.size() > 1 ? "s" : "");

            for (final String rbFilename : list) {
                readPropertiesFile(rbFilename);
            }
        }
    }
743150
public function collectGarbage()
    {

        // we need the bean manager that handles all the beans
        /** @var \AppserverIo\Psr\EnterpriseBeans\BeanContextInterface $beanManager */
        $beanManager = $this->getApplication()->search(BeanContextInterface::IDENTIFIER);

        // load the map with the stateful session beans
        /** @var \AppserverIo\Storage\StorageInterface $statefulSessionBeans */
        $statefulSessionBeans = $beanManager->getStatefulSessionBeans();

        // initialize the timestamp with the actual time
        $actualTime = time();

        // load the map with the SFSB lifetime data
        $lifetimeMap = $statefulSessionBeans->getLifetime();

        // initialize the counter for the SFSBs
        $counter = 0;

        // iterate over the applications sessions with stateful session beans
        foreach ($lifetimeMap as $identifier => $lifetime) {
            // check the lifetime of the stateful session beans
            if ($lifetime < $actualTime) {
                // if the stateful session bean has timed out, remove it
                $statefulSessionBeans->remove($identifier, array($beanManager, 'destroyBeanInstance'));
                // write a log message
                $this->log(LogLevel::DEBUG, sprintf('Successfully removed SFSB %s', $identifier));
                // reduce CPU load
                usleep(1000);
            } else {
                // raise the counter
                $counter++;
                // write a log message
                $this->log(LogLevel::DEBUG, sprintf('Lifetime %s of SFSB %s is > %s', $lifetime, $identifier, $actualTime));
            }
        }

        // write a log message with size of SFSBs to be garbage collected
        $this->log(LogLevel::DEBUG, sprintf('Found %d SFSBs be garbage collected', $counter));

        // profile the size of the sessions
        /** @var \Psr\Log\LoggerInterface $this->profileLogger */
        if ($this->profileLogger) {
            $this->profileLogger->debug(
                sprintf('Processed standard garbage collector, handling %d SFSBs', sizeof($statefulSessionBeans))
            );
        }
    }
659788
def read(file, system):
    """"""
    func = re.compile('function\\s')
    mva = re.compile('\\s*mpc.baseMVA\\s*=\\s*')
    bus = re.compile('\\s*mpc.bus\\s*=\\s*\\[')
    gen = re.compile('\\s*mpc.gen\\s*=\\s*\\[')
    branch = re.compile('\\s*mpc.branch\\s*=\\s*\\[')
    area = re.compile('\\s*mpc.areas\\s*=\\s*\\[')
    gencost = re.compile('\\s*mpc.gencost\\s*=\\s*\\[')
    bus_name = re.compile('\\s*mpc.bus_name\\s*=\\s*\\{')
    end = re.compile('\\s*\\];?')
    hasdigit = re.compile('.*\\d+\\s*]?;?')
    comment = re.compile('\\s*%.*')

    retval = True
    field = None
    info = True

    basemva = 100
    mpc = {
        'bus': [],
        'gen': [],
        'branch': [],
        'area': [],
        'gencost': [],
        'bus_name': [],
    }

    fid = open(file, 'r')

    for line in fid:
        line = line.strip().rstrip(';')
        if not line:
            continue
        elif func.search(line):  # skip function declaration
            continue
        elif comment.search(line):  # for comment lines
            if info:
                logger.info(line[1:72])
                info = False
            else:
                continue
        elif mva.search(line):
            basemva = float(line.split('=')[1])

        if not field:
            if bus.search(line):
                field = 'bus'
            elif gen.search(line):
                field = 'gen'
            elif branch.search(line):
                field = 'branch'
            elif area.search(line):
                field = 'area'
            elif gencost.search(line):
                field = 'gencost'
            elif bus_name.search(line):
                field = 'bus_name'
            else:
                continue
        elif end.search(line):
            field = None
            continue

        # parse mpc sections
        if field:
            if line.find('=') >= 0:
                line = line.split('=')[1]
            if line.find('[') >= 0:
                line = re.sub(r'\[', '', line)
            elif line.find('{') >= 0:
                line = re.sub(r'{', '', line)

            if line.find('\'') >= 0:  # bus_name
                line = line.split(';')
                data = [i.strip('\'').strip() for i in line]
                mpc['bus_name'].extend(data)
            else:
                if not hasdigit.search(line):
                    continue
                line = line.split(';')
                for item in line:
                    data = [float(val) for val in item.split()]
                    mpc[field].append(data)

    fid.close()

    # add model elements to system
    sw = []

    system.mva = basemva

    for data in mpc['bus']:
        # idx  ty   pd   qd  gs  bs  area  vmag  vang  baseKV  zone  vmax  vmin
        # 0    1    2   3   4   5    6      7     8     9      10    11    12
        idx = int(data[0])
        ty = data[1]
        if ty == 3:
            sw.append(idx)
        pd = data[2] / basemva
        qd = data[3] / basemva
        gs = data[4] / basemva
        bs = data[5] / basemva
        area = data[6]
        vmag = data[7]
        vang = data[8] * deg2rad
        baseKV = data[9]
        zone = data[10]
        vmax = data[11]
        vmin = data[12]

        try:
            system.Bus.elem_add(
                idx=idx,
                name='Bus ' + str(idx),
                Vn=baseKV,
                voltage=vmag,
                angle=vang,
                vmax=vmax,
                vmin=vmin,
                area=area,
                region=zone)
            if pd or qd:
                system.PQ.elem_add(
                    bus=idx, name='PQ ' + str(idx), Vn=baseKV, p=pd, q=qd)
            if gs or bs:
                system.Shunt.elem_add(
                    bus=idx, name='Shunt ' + str(idx), Vn=baseKV, g=gs, b=bs)
        except KeyError:
            logger.error('Error adding <Bus> to powersystem object.')
            retval = False

    gen_idx = 0
    for data in mpc['gen']:
        # bus  pg  qg  qmax  qmin  vg  mbase  status  pmax  pmin  pc1  pc2
        #  0   1   2    3     4     5    6      7       8    9    10    11
        # qc1min  qc1max  qc2min  qc2max  ramp_agc  ramp_10  ramp_30  ramp_q
        #  12      13       14      15      16        17       18      19
        # apf
        #  20

        bus_idx = int(data[0])
        gen_idx += 1
        vg = data[5]
        status = int(data[7])
        mbase = basemva
        pg = data[1] / mbase
        qg = data[2] / mbase
        qmax = data[3] / mbase
        qmin = data[4] / mbase
        pmax = data[8] / mbase
        pmin = data[9] / mbase

        try:
            vn = system.Bus.Vn[system.Bus.uid[bus_idx]]
            if bus_idx in sw:
                system.SW.elem_add(
                    idx=gen_idx,
                    bus=bus_idx,
                    busr=bus_idx,
                    name='SW ' + str(bus_idx),
                    u=status,
                    Vn=vn,
                    v0=vg,
                    pg=pg,
                    qg=qg,
                    pmax=pmax,
                    pmin=pmin,
                    qmax=qmax,
                    qmin=qmin,
                    a0=0.0)
            else:
                system.PV.elem_add(
                    idx=gen_idx,
                    bus=bus_idx,
                    busr=bus_idx,
                    name='PV ' + str(bus_idx),
                    u=status,
                    Vn=vn,
                    v0=vg,
                    pg=pg,
                    qg=qg,
                    pmax=pmax,
                    pmin=pmin,
                    qmax=qmax,
                    qmin=qmin)
        except KeyError:
            logger.error(
                'Error adding <SW> or <PV> to powersystem object.')
            retval = False

    for data in mpc['branch']:
        # fbus	tbus	r	x	b	rateA	rateB	rateC	ratio	angle
        #  0     1      2   3   4     5       6       7       8      9
        # status	angmin	angmax	Pf	Qf	Pt	Qt
        #   10       11       12    13  14  15  16
        fbus = data[0]
        tbus = data[1]
        r = data[2]
        x = data[3]
        b = data[4]
        status = int(data[10])

        if data[8] == 0.0:  # not a transformer
            tf = False
            ratio = 1
            angle = 0
        elif data[8] == 1.0 and data[9] == 0.0:  # not a transformer
            tf = False
            ratio = 1
            angle = 0
        else:
            tf = True
            ratio = data[8]
            angle = data[9]
        try:
            vf = system.Bus.Vn[system.Bus.uid[fbus]]
            vt = system.Bus.Vn[system.Bus.uid[tbus]]
            system.Line.elem_add(
                Vn=vf,
                Vn2=vt,
                bus1=fbus,
                bus2=tbus,
                r=r,
                x=x,
                b=b,
                u=status,
                trasf=tf,
                tap=ratio,
                phi=angle)
        except KeyError:
            logger.error('Error adding <Line> to powersystem object.')
            retval = False
    if len(mpc['bus_name']) == len(system.Bus.name):
        system.Bus.name[:] = mpc['bus_name']

    return retval
548828
public void readObject(java.io.DataInputStream dataInputStream,
                           ObjectManagerState objectManagerState)
                    throws ObjectManagerException {
        final String methodName = "readObject";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName, new Object[] { dataInputStream,
                                                                objectManagerState });

        try {
            byte version = dataInputStream.readByte();
            if (Tracing.isAnyTracingEnabled() && trace.isDebugEnabled())
                trace.debug(this, cclass, methodName, new Object[] { new Byte(version) });
            super.readObject(dataInputStream, objectManagerState);

            if (dataInputStream.readByte() == 1) {
                // Use ManagedObjectInpuStream so as to get the correct classloader.
                java.io.ObjectInputStream objectInputStream = new ManagedObjectInputStream(dataInputStream, objectManagerState);
                comparator = (java.util.Comparator) objectInputStream.readObject();
                objectInputStream.close();
            } // if (dataInputStream.readByte() == 1).
            if (dataInputStream.readByte() == 1) {
                root = Token.restore(dataInputStream
                                     , objectManagerState
                                );
            } // if (dataInputStream.readByte() == 1).
            size = dataInputStream.readLong();

        } catch (java.io.IOException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:2412:1.44");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass, methodName, exception);
            throw new PermanentIOException(this, exception);

        } catch (java.lang.ClassNotFoundException exception) {
            // No FFDC Code Needed.
            ObjectManager.ffdc.processException(this, cclass, methodName, exception, "1:2420:1.44");

            if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                trace.exit(this, cclass, methodName, new Object[] { "ClassNotFoundException:2423",
                                                                   exception });
            throw new com.ibm.ws.objectManager.ClassNotFoundException(this, exception);
        } // try.

        availableSize = size; // Start as last commited.

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }