/* (non-Javadoc)
@see com.ibm.ws.sib.processor.impl.store.itemstreams.SIMPItemStream#getPersistentData(java.io.ObjectOutputStream)
322248
public void getPersistentData(ObjectOutputStream oos)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getPersistentData", oos);

    try
    {
      HashMap hm = new HashMap();

      hm.put("iMEUuid", iMEUuid.toByteArray());
      hm.put("iBusId", iBusId);

      oos.writeObject(hm);
    }
    catch (java.io.IOException e)
    {
      // FFDC
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.proxyhandler.Neighbour.getPersistentData",
        "1:1116:1.107",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.proxyhandler.Neighbour",
          "1:1123:1.107",
          e });

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", "SIErrorException");

      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.proxyhandler.Neighbour",
            "1:1133:1.107",
            e },
          null),
        e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPersistentData");
  }
1352387
public PersistentTranId getPersistentTranId()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(this, tc, "getPersistentTranId");
            SibTr.exit(this, tc, "getPersistentTranId", "return="+_ptid);
        }
        return _ptid;
    }
983450
public void getPersistentData(ObjectOutputStream dos)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(this, tc, "getPersistentData", dos);

    try
    {      
      MessagingEngine cellule = new MessagingEngine(remoteMEUuid);
      byte[] celluleBytes = cellule.getBytes();
      int celluleBytesLen = celluleBytes.length;
      byte[] streamBytes  = streamID.toByteArray(); 
      int streamBytesLen  = streamBytes.length;   
      byte[] destBytes    = destID.toByteArray();  
      int destBytesLen    = destBytes.length;
      byte[] busBytes     = busID.toByteArray();  
      int busBytesLen     = busBytes.length;
       
      byte[] copy = new byte[celluleBytesLen
                             + streamBytesLen
                             + destBytesLen
                             + busBytesLen];
      
      System.arraycopy(celluleBytes, 0, copy, 0, celluleBytesLen);
      System.arraycopy(streamBytes,  0, copy, celluleBytesLen, streamBytesLen);
      System.arraycopy(destBytes, 0, copy, 
                       celluleBytesLen + streamBytesLen,
                       destBytesLen);
      System.arraycopy(busBytes, 0, copy, 
                       celluleBytesLen + streamBytesLen + destBytesLen, 
                       busBytesLen);
                    
      dos.write(copy);
      dos.writeLong(initialData);
      dos.writeInt(type.toInt());
      
      //just to be safe write out the number of subsets we have
      dos.writeInt(subsets.length);
      //then each of the subset ids and their reliabilities
      for(int i=0;i<subsets.length;i++)
      {
        dos.writeLong(subsetIDs[i]);
        dos.writeInt(subsets[i].getReliability().toInt()); 
      }
      
      //SIB0105.mp.6
      dos.writeObject(linkTarget);
    }
    catch (java.io.IOException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.gd.StreamSet.getPersistentData",
        "1:545:1.67",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.gd.StreamSet",
          "1:552:1.67",
          e });
      
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getPersistentData", "SIErrorException");
      
      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.gd.StreamSet",
            "1:562:1.67",
            e },
          null),
        e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPersistentData");
  }
1213708
static Stream<Attribute> getPersistedAttributes(EntityType entityType) {
    return stream(entityType.getAtomicAttributes())
        .filter(atomicAttr -> atomicAttr.getExpression() == null);
  }
1297058
function savePersistentData()
    {
        $this->HTTP->setSessionVariable( $this->StorageName . $this->MetaDataName, $this->MetaData );
        $this->HTTP->setSessionVariable( $this->StorageName . $this->VariableListName, $this->VariableList );
    }
1257317
private static PersistenceUnitMetadata parsePersistenceUnit(final URL url, final String[] persistenceUnits,
            Element top, final String versionName)
    {
        PersistenceUnitMetadata metadata = new PersistenceUnitMetadata(versionName, getPersistenceRootUrl(url), url);

        String puName = top.getAttribute("name");

        if (!Arrays.asList(persistenceUnits).contains(puName))
        {
            // Returning null because this persistence unit is not intended for
            // creating entity manager factory.
            return null;
        }

        if (!isEmpty(puName))
        {
            log.trace("Persistent Unit name from persistence.xml: " + puName);
            metadata.setPersistenceUnitName(puName);
            String transactionType = top.getAttribute("transaction-type");
            if (StringUtils.isEmpty(transactionType)
                    || PersistenceUnitTransactionType.RESOURCE_LOCAL.name().equals(transactionType))
            {
                metadata.setTransactionType(PersistenceUnitTransactionType.RESOURCE_LOCAL);
            }
            else if (PersistenceUnitTransactionType.JTA.name().equals(transactionType))
            {
                metadata.setTransactionType(PersistenceUnitTransactionType.JTA);
            }
        }

        NodeList children = top.getChildNodes();
        for (int i = 0; i < children.getLength(); i++)
        {
            if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
            {
                Element element = (Element) children.item(i);
                String tag = element.getTagName();

                if (tag.equals("provider"))
                {
                    metadata.setProvider(getElementContent(element));
                }
                else if (tag.equals("properties"))
                {
                    NodeList props = element.getChildNodes();
                    for (int j = 0; j < props.getLength(); j++)
                    {
                        if (props.item(j).getNodeType() == Node.ELEMENT_NODE)
                        {
                            Element propElement = (Element) props.item(j);
                            // if element is not "property" then skip
                            if (!"property".equals(propElement.getTagName()))
                            {
                                continue;
                            }

                            String propName = propElement.getAttribute("name").trim();
                            String propValue = propElement.getAttribute("value").trim();
                            if (isEmpty(propValue))
                            {
                                propValue = getElementContent(propElement, "");
                            }
                            metadata.getProperties().put(propName, propValue);
                        }
                    }
                }
                else if (tag.equals("class"))
                {
                    metadata.getClasses().add(getElementContent(element));
                }
                else if (tag.equals("jar-file"))
                {
                    metadata.addJarFile(getElementContent(element));
                }
                else if (tag.equals("exclude-unlisted-classes"))
                {
                    String excludeUnlisted = getElementContent(element);
                    metadata.setExcludeUnlistedClasses(Boolean.parseBoolean(excludeUnlisted));
                }
            }
        }
        PersistenceUnitTransactionType transactionType = getTransactionType(top.getAttribute("transaction-type"));
        if (transactionType != null)
        {
            metadata.setTransactionType(transactionType);
        }

        return metadata;
    }
513403
public boolean isPersistent()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
    {
      SibTr.entry(this, tc, "isPersistent");
      SibTr.exit(tc, "isPersistent", Boolean.valueOf(persistent));	
    }
    return persistent;
  }
1077953
public com.google.protobuf.ByteString
      getPersistenceStateBytes() {
    java.lang.Object ref = persistenceState_;
    if (ref instanceof java.lang.String) {
      com.google.protobuf.ByteString b = 
          com.google.protobuf.ByteString.copyFromUtf8(
              (java.lang.String) ref);
      persistenceState_ = b;
      return b;
    } else {
      return (com.google.protobuf.ByteString) ref;
    }
  }
929199
@Override
    public void setNonPersistentMapping(String nonPersistentMapping) throws JMSException {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "setNonPersistentMapping", nonPersistentMapping);

        if (nonPersistentMapping == null) {
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "INVALID_VALUE_CWSIA0261",
                                                            new Object[] { "nonPersistentMapping", null },
                                                            tc
                            );
        }

        if (nonPersistentMapping.equals(ApiJmsConstants.MAPPING_BEST_EFFORT_NONPERSISTENT) ||
            nonPersistentMapping.equals(ApiJmsConstants.MAPPING_EXPRESS_NONPERSISTENT) ||
            nonPersistentMapping.equals(ApiJmsConstants.MAPPING_RELIABLE_NONPERSISTENT) ||
            nonPersistentMapping.equals(ApiJmsConstants.MAPPING_RELIABLE_PERSISTENT) ||
            nonPersistentMapping.equals(ApiJmsConstants.MAPPING_ASSURED_PERSISTENT) ||
            nonPersistentMapping.equals(ApiJmsConstants.MAPPING_NONE)) {
            jcaManagedConnectionFactory.setNonPersistentMapping(nonPersistentMapping);
        }
        else if (nonPersistentMapping.equals(ApiJmsConstants.MAPPING_AS_SIB_DESTINATION)) {
            jcaManagedConnectionFactory.setNonPersistentMapping(ApiJmsConstants.MAPPING_NONE);
        }
        else {
            throw (JMSException) JmsErrorUtils.newThrowable(
                                                            JMSException.class,
                                                            "INVALID_VALUE_CWSIA0261",
                                                            new Object[] { "nonPersistentMapping", nonPersistentMapping },
                                                            tc
                            );
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "setNonPersistentMapping");
    }
178691
public long getUniqueValue() throws PersistenceException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getUniqueValue");

        long retval;
            
        synchronized (_globalUniqueLock) 
        {
            if (_globalUnique == _globalUniqueThreshold) 
            {
                _globalUniqueManager.scheduleUpdate(this);
            }
            else if (_globalUnique == _globalUniqueLimit) 
            {
                _globalUniqueManager.updateEntry(this);
                nextRangeMaximumAvailable();
            }
            
            retval = _globalUnique++;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getUniqueValue", "return="+retval);
        return retval;
    }
314064
public Object getPersistentState() {
    Map<String, Object> persistentState = new HashMap<String, Object>();
    persistentState.put("name", name);
    persistentState.put("owner", owner);
    persistentState.put("assignee", assignee);
    persistentState.put("endTime", endTime);
    persistentState.put("durationInMillis", durationInMillis);
    persistentState.put("description", description);
    persistentState.put("deleteReason", deleteReason);
    persistentState.put("taskDefinitionKey", taskDefinitionKey);
    persistentState.put("formKey", formKey);
    persistentState.put("priority", priority);
    persistentState.put("category", category);
    persistentState.put("processDefinitionId", processDefinitionId);
    if (parentTaskId != null) {
      persistentState.put("parentTaskId", parentTaskId);
    }
    if (dueDate != null) {
      persistentState.put("dueDate", dueDate);
    }
    if (claimTime != null) {
      persistentState.put("claimTime", claimTime);
    }
    return persistentState;
  }
1366345
public static String getReference(ValueData valueData) throws RepositoryException
   {
      if (valueData instanceof TransientValueData)
      {
         return getReference(((TransientValueData)valueData).delegate);
      }

      return ((AbstractValueData)valueData).getReference();
   }
483313
public PersistenceManager getPersistenceManager() {
        if (persistenceManager == null) {
            try {
                persistenceManager = getPresentationManager().newPersistenceManager();
            } catch (Exception ex) {
                getPresentationManager().error(ex);
                throw new ConnectionNotFoundException();
            }
        }
        return persistenceManager;
    }
108287
@Override
    public int getStorageStrategy()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "getStorageStrategy");

        int storageStrategy;

        Reliability rel = getReliability();
        if (rel == Reliability.BEST_EFFORT_NONPERSISTENT)
        {
            storageStrategy = STORE_NEVER;
        }
        else
        {
            // If the message has a reliability of Assured the storage strategy is
            // STORE_ALWAYS except when this message is for pubsub and only has
            // non-durable references. In this case the references will be
            // STORE_MAYBE as there is no need to make the message more robust.
            if ((maintainPersistence != 0)
                && (rel == Reliability.RELIABLE_PERSISTENT))
            {
                storageStrategy = STORE_EVENTUALLY;
            }
            else if ((maintainPersistence != 0)
                     && (rel == Reliability.ASSURED_PERSISTENT))
            {
                storageStrategy = STORE_ALWAYS;
            }
            else
            {
                storageStrategy = STORE_MAYBE;
            }
        }

        // ensure value does not exceed maximum permitted, eg not
        // possible to store assured on a temporary destination
        storageStrategy =
                        storageStrategy < maxStorageStrategy
                                        ? storageStrategy
                                        : maxStorageStrategy;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "getStorageStrategy", Integer.valueOf(storageStrategy));

        return storageStrategy;
    }
636586
public void getPersistentData(ObjectOutputStream oos)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "getPersistentData", oos);
    
    try 
    {
      oos.writeObject(messagingEngineUuid.toByteArray());
    }
    catch (java.io.IOException e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.store.MessageProcessorStore.getPersistentData",
        "1:210:1.42",
        this);

      SibTr.exception(tc, e);
      SibTr.error(tc, "INTERNAL_MESSAGING_ERROR_CWSIP0002",
        new Object[] {
          "com.ibm.ws.sib.processor.impl.store.MessageProcessorStore",
          "1:217:1.42",
          e });
      
      if (tc.isEntryEnabled()) 
        SibTr.exit(tc, "getPersistentData", "SIErrorException");

      throw new SIErrorException(
        nls.getFormattedMessage(
          "INTERNAL_MESSAGING_ERROR_CWSIP0002",
          new Object[] {
            "com.ibm.ws.sib.processor.impl.store.MessageProcessorStore",
            "1:228:1.42",
            e },
          null),
        e);
    }
  
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "getPersistentData");
  }
93202
@Override
    public WsByteBuffer getRemainingData() {

        if (!isReadDataAvailable()) {
            return null;
        }

        WsByteBuffer retBuf = null;

        int position = getReadBuffer().position();
        int limit = getReadBuffer().limit();

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Current body buffer " + getReadBuffer());
        }

        if (0 == position && limit == getReadBuffer().capacity()) {
            // this is a full buff we can return
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Return a full buffer");
            }
            retBuf = returnLastBuffer();

        } else {
            // slice up a return
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Slice the return buffer");
            }
            // slice from the position set above
            retBuf = getReadBuffer().slice();

        }

        return retBuf;

    }
1374067
public static List<PersistenceUnitMetadata> findPersistenceUnits(final URL url, final String[] persistenceUnits,
            PersistenceUnitTransactionType defaultTransactionType) throws InvalidConfigurationException
    {
        Document doc;
        try
        {
            doc = getDocument(url);
        }
        catch (InvalidConfigurationException e)
        {
            throw e;
        }
        doc.getXmlVersion();
        Element top = doc.getDocumentElement();

        String versionName = top.getAttribute("version");

        NodeList children = top.getChildNodes();
        ArrayList<PersistenceUnitMetadata> units = new ArrayList<PersistenceUnitMetadata>();

        // parse for persistenceUnitRootInfoURL.
        for (int i = 0; i < children.getLength(); i++)
        {
            if (children.item(i).getNodeType() == Node.ELEMENT_NODE)
            {
                Element element = (Element) children.item(i);
                String tag = element.getTagName();
                // look for "persistence-unit" element
                if (tag.equals("persistence-unit"))
                {
                    PersistenceUnitMetadata metadata = parsePersistenceUnit(url, persistenceUnits, element, versionName);
                    if (metadata != null)
                    {
                        units.add(metadata);
                    }
                }
            }
        }
        return units;
    }