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

    try
    {
      dout.writeUTF(remoteMEId.toString()); 
      dout.writeUTF(streamId.toString());
      String id = NULL;
      if (gatheringTargetDestUuid!=null) 
        id = gatheringTargetDestUuid.toString();
      dout.writeUTF(id); 
    }
    catch (IOException e)
    {
      // No FFDC code needed
      SIErrorException e2 = new SIErrorException(e);

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

      throw e2;
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPersistentData");
  }
1359176
protected int persistHydrant(
      FireHydrant indexToPersist,
      DataSchema schema,
      Interval interval,
      Map<String, Object> metadataElems
  )
  {
    synchronized (indexToPersist) {
      if (indexToPersist.hasSwapped()) {
        log.info(
            "DataSource[%s], Interval[%s], Hydrant[%s] already swapped. Ignoring request to persist.",
            schema.getDataSource(), interval, indexToPersist
        );
        return 0;
      }

      log.info(
          "DataSource[%s], Interval[%s], Metadata [%s] persisting Hydrant[%s]",
          schema.getDataSource(),
          interval,
          metadataElems,
          indexToPersist
      );
      try {
        int numRows = indexToPersist.getIndex().size();

        final IndexSpec indexSpec = config.getIndexSpec();

        indexToPersist.getIndex().getMetadata().putAll(metadataElems);
        final File persistedFile = indexMerger.persist(
            indexToPersist.getIndex(),
            interval,
            new File(computePersistDir(schema, interval), String.valueOf(indexToPersist.getCount())),
            indexSpec,
            config.getSegmentWriteOutMediumFactory()
        );

        indexToPersist.swapSegment(
            new QueryableIndexSegment(indexIO.loadIndex(persistedFile), indexToPersist.getSegmentId())
        );
        return numRows;
      }
      catch (IOException e) {
        log.makeAlert("dataSource[%s] -- incremental persist failed", schema.getDataSource())
           .addData("interval", interval)
           .addData("count", indexToPersist.getCount())
           .emit();

        throw new RuntimeException(e);
      }
    }
  }
125694
protected List<PropertyData> listChildPropertiesData(final NodeData nodeData, boolean forcePersistentRead)
      throws RepositoryException
   {

      List<PropertyData> propertiesList;
      if (!forcePersistentRead && cache.isEnabled())
      {
         propertiesList = cache.listChildProperties(nodeData);
         if (propertiesList != null)
         {
            return propertiesList;
         }
      }

      final DataRequest request = new DataRequest(nodeData.getIdentifier(), DataRequest.GET_LIST_PROPERTIES);
      try
      {
         request.start();
         if (!forcePersistentRead && cache.isEnabled())
         {
            // Try first to get the value from the cache since a
            // request could have been launched just before
            propertiesList = cache.listChildProperties(nodeData);
            if (propertiesList != null)
            {
               return propertiesList;
            }
         }
         return executeAction(new PrivilegedExceptionAction<List<PropertyData>>()
         {
            public List<PropertyData> run() throws RepositoryException
            {
               List<PropertyData> propertiesList =
                  CacheableWorkspaceDataManager.super.listChildPropertiesData(nodeData);

               if (propertiesList.size() > 0 && cache.isEnabled())
               {
                  cache.addChildPropertiesList(nodeData, propertiesList);
               }
               return propertiesList;
            }
         });
      }
      finally
      {
         request.done();
      }
   }
1271293
void extractPersistenceUnits(JPAPXml pxml) {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "extractPersistenceUnits : " + pxml);

        // Determines the correct schema version, and uses the correct version
        // of JAXB generated classes to parse the persistence.xml file... and
        // the correct version of .xsd to validate against.            F1879-16302
        JaxbPersistence p = JaxbUnmarshaller.unmarshal(pxml);

        List<JaxbPUnit> pus = p.getPersistenceUnit();
        for (JaxbPUnit pu : pus) {
            // Guarantee to have a puName from <persistence-unit>
            String puName = pu.getName();
            // Set <persistence-unit>
            JPAApplInfo applInfo = pxml.getApplInfo();
            JPAPuId puId = new JPAPuId(applInfo.getApplName(), pxml.getArchiveName(), puName); // d689596
            JPAPUnitInfo puInfo = applInfo.createJPAPUnitInfo(puId, pxml, ivScopeInfo);

            // set XML Schema version
            puInfo.setPersistenceXMLSchemaVersion(p.getVersion());

            // Must set the root URL first for other puInfo attribute to reference
            // determine the root of the persistence unit.
            puInfo.setPersistenceUnitRootUrl(pxml.getRootURL());

            // JaxbPunit abstraction properly maps the TransactionType from
            // the JAXB generated class to the JPA enum value.          F1879-16302
            puInfo.setTransactionType(pu.getTransactionType());

            // Set <persistence-unit>
            puInfo.setPersistenceUnitDescription(pu.getDescription());

            // Set <provider>
            puInfo.setPersistenceProviderClassName(pu.getProvider());

            // Set <jta-data-source>
            puInfo.setJtaDataSource(pu.getJtaDataSource());

            // Set <nonjta-data-source>
            puInfo.setNonJtaDataSource(pu.getNonJtaDataSource());

            // Set <mapping-file>
            puInfo.setMappingFileNames(pu.getMappingFile());

            // Set <jar-file>
            puInfo.setJarFileUrls(pu.getJarFile(), pxml); //PK62950

            // Set <class>
            puInfo.setManagedClassNames(pu.getClazz());

            // Set <shared-cache-mode> (mapped by JaxbPUnit abstraction) // F743-8705 F1879-16302
            puInfo.setSharedCacheMode(pu.getSharedCacheMode());

            // Set <validataion-mode> (mapped by JaxbPUnit abstraction)  // F743-8705 F1879-16302
            puInfo.setValidationMode(pu.getValidationMode());

            // Set <exclude-unlisted-classes>
            puInfo.setExcludeUnlistedClasses(pu.isExcludeUnlistedClasses());

            // Set <properties> (mapped by JaxbPUnit abstraction)       F1879-16302
            puInfo.setProperties(pu.getProperties());

            if (isTraceOn && tc.isDebugEnabled()) {
                String rootURLStr = pxml.getRootURL().getFile();
                int earIndex = rootURLStr.indexOf(applInfo.getApplName() + ".ear"); // d507361
                if (earIndex != -1) { // d507361
                    rootURLStr = rootURLStr.substring(earIndex // d507361
                                                      + applInfo.getApplName().length() + 5); // d507361
                } // d507361
                rootURLStr += PERSISTENCE_XML_RESOURCE_NAME; // d507361
                Tr.debug(tc, "extractPersistenceUnits : " + applInfo.getApplName() +
                             "|" + pxml.getArchiveName() + "|" + rootURLStr + "|" +
                             puInfo.getPersistenceUnitName() + "|" +
                             ivScopeInfo.getScopeType() + "|" + puInfo.dump());
            }

            if (getPuInfo(puName) != null) // d441029
            {
                Tr.warning(tc,
                           "DUPLICATE_PERSISTENCE_UNIT_DEFINED_CWWJP0007W",
                           puName, applInfo.getApplName(), pxml.getArchiveName()); // d460065
                puInfo.close(); // d681393
            } else {
                addPU(puName, puInfo);

                // This getFactory initiates the createEntityManagerFactory call to
                // the persistence provider for this pu. This process will trigger
                // the provider to use the jta/non-jta data source defined in the
                // pu as well as register transformer to the application classloader
                // so that when entity class is loaded, the provider can enhance
                // the entity class.
                //
                // However if the factory is created at this point, the resource
                // ref defined for the associated component has not been initialized
                // yet and hence the java:comp/env scheme of specifying data sources
                // in persistence.xml can not be processed.
                //
                // But, if the factory is NOT created at this point, the provider
                // will not register the transformer, and thus the class will not
                // be transformed when it is loaded.
                //
                // To solve this problem, the factory will be created now, and a
                // 'generic' datasource will be provided, but, the created factory
                // will never be used. When a component finally accesses a factory,
                // (after the component has started), a new factory will be created,
                // one for every java:comp/env name context.  Then, each component
                // will have a factory created with the correct datasource.
                puInfo.initialize(); // d429219 d510184
            }

            JPAIntrospection.visitJPAPUnitInfo(puName, puInfo);
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "extractPersistenceUnits : # of PU defined = " + getPuCount());
    }
224352
@IocBean(name = "mqttClientPersistence")
    public MqttClientPersistence createMqttClientPersistence() {
        switch (conf.get(PROP_PERSISTENCE_TYPE, "memory")) {
        case "file":
            return new MqttDefaultFilePersistence(conf.get(PROP_PERSISTENCE_PATH, System.getProperty("user.dir")));
        default:
            return new MemoryPersistence();
        }
    }
922926
private void parsePersistence(Map<Object, Object> props) {
        parseKeepAliveEnabled(props);
        if (isKeepAliveEnabled()) {
            parseMaxPersist(props);
        }
    }
1287882
public PersistedPropertyData read(ObjectReader in) throws UnknownClassIdException, IOException
   {
      // read id
      int key;
      if ((key = in.readInt()) != SerializationConstants.PERSISTED_PROPERTY_DATA)
      {
         throw new UnknownClassIdException("There is unexpected class [" + key + "]");
      }

      QPath qpath;
      try
      {
         String sQPath = in.readString();
         qpath = QPath.parse(sQPath);
      }
      catch (final IllegalPathException e)
      {
         throw new IOException("Deserialization error. " + e)
         {

            /**
             * {@inheritDoc}
             */
            @Override
            public Throwable getCause()
            {
               return e;
            }
         };
      }

      String identifier = in.readString();

      String parentIdentifier = null;
      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
      {
         parentIdentifier = in.readString();
      }

      int persistedVersion = in.readInt();
      // --------------

      int type = in.readInt();
      boolean multiValued = in.readBoolean();
      PersistedSize persistedSizeHandler = new SimplePersistedSize(in.readLong());

      PersistedPropertyData prop;

      if (in.readByte() == SerializationConstants.NOT_NULL_DATA)
      {

         int listSize = in.readInt();
         List<ValueData> values = new ArrayList<ValueData>();
         PersistedValueDataReader rdr = new PersistedValueDataReader(holder, spoolConfig);
         for (int i = 0; i < listSize; i++)
         {
            values.add(rdr.read(in, type));
         }

         prop =
            new PersistedPropertyData(identifier, qpath, parentIdentifier, persistedVersion, type, multiValued, values,
               persistedSizeHandler);
      }
      else
      {
         prop =
            new PersistedPropertyData(identifier, qpath, parentIdentifier, persistedVersion, type, multiValued, null,
               persistedSizeHandler);
      }

      return prop;
   }
1186676
public void restorePersistentDestinationData(HashMap hm) throws Exception
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "restorePersistentDestinationData", new Object[] { hm });
        //, Integer.valueOf(dataVersion)

        super.restorePersistentData(hm);

        // Restore boolean flags
        //isLocal = ((Boolean) hm.get("isLocal")).booleanValue();
        _toBeDeleted = ((Boolean) hm.get("toBeDeleted")).booleanValue();
        _isTemporary = ((Boolean) hm.get("isTemporary")).booleanValue();
        _toBeIgnored = ((Boolean) hm.get("toBeIgnored")).booleanValue();
        _isSystem =
                        definition.getName().startsWith(SIMPConstants.SYSTEM_DESTINATION_PREFIX);

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "restorePersistentDestinationData");
    }
255046
public void writePersistentUrl(String url, String value) throws Exception {

        store.write(url, value);
    }
493468
static PersistentAttributeType getPersistentAttributeType(Field member)
    {
        PersistentAttributeType attributeType = PersistentAttributeType.BASIC;
        if (member.isAnnotationPresent(ElementCollection.class))
        {
            attributeType = PersistentAttributeType.ELEMENT_COLLECTION;
        }
        else if (member.isAnnotationPresent(OneToMany.class))
        {
            attributeType = PersistentAttributeType.ONE_TO_MANY;
        }
        else if (member.isAnnotationPresent(ManyToMany.class))
        {
            attributeType = PersistentAttributeType.MANY_TO_MANY;
        }
        else if (member.isAnnotationPresent(ManyToOne.class))
        {
            attributeType = PersistentAttributeType.MANY_TO_ONE;
        }
        else if (member.isAnnotationPresent(OneToOne.class))
        {
            attributeType = PersistentAttributeType.ONE_TO_ONE;
        }
        else if (member.isAnnotationPresent(Embedded.class))
        {
            attributeType = PersistentAttributeType.EMBEDDED;
        }

        return attributeType;

    }
930089
protected long getPersistentData(int priority, Reliability reliability) throws SIResourceException
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(
        tc,
        "getPersistentData",
        new Object[] { new Integer(priority), reliability });

    long prefix = getSubset(reliability).getPersistentData(priority);
        
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "getPersistentData", new Long(prefix));
      
    return prefix;
  }
315972
public static PersistenceUnitMetadata getPersistenceUnitMetadata(final KunderaMetadata kunderaMetadata,
            String persistenceUnit)
    {
        if (persistenceUnit != null && kunderaMetadata != null)
        {
            return kunderaMetadata.getApplicationMetadata().getPersistenceUnitMetadata(persistenceUnit);
        }
        return null;
    }
66207
public Object getPersistentState() {
   Map<String, Object> persistentState = new HashMap<String, Object>();
   persistentState.put("processDefinitionId", this.processDefinitionId);
   persistentState.put("businessKey", this.businessKey);
   persistentState.put("activityId", this.activityId);
   persistentState.put("isActive", this.isActive);
   persistentState.put("isConcurrent", this.isConcurrent);
   persistentState.put("isScope", this.isScope);
   persistentState.put("isEventScope", this.isEventScope);
   persistentState.put("parentId", parentId);
   persistentState.put("name", name);
   persistentState.put("lockTime", lockTime);
   persistentState.put("superExecution", this.superExecutionId);
   persistentState.put("rootProcessInstanceId", this.rootProcessInstanceId);
   if (forcedUpdate) {
     persistentState.put("forcedUpdate", Boolean.TRUE);
   }
   persistentState.put("suspensionState", this.suspensionState);
   persistentState.put("startTime", this.startTime);
   persistentState.put("startUserId", this.startUserId);
   persistentState.put("eventSubscriptionCount", eventSubscriptionCount);
   persistentState.put("taskCount", taskCount);
   persistentState.put("jobCount", jobCount);
   persistentState.put("timerJobCount", timerJobCount);
   persistentState.put("suspendedJobCount", suspendedJobCount);
   persistentState.put("deadLetterJobCount", deadLetterJobCount);
   persistentState.put("variableCount", variableCount);
   persistentState.put("identityLinkCount", identityLinkCount);
   return persistentState;
 }
563500
protected long writeOutput(OutputStream out, ValueData value) throws IOException
   {
      if (value.isByteArray())
      {
         byte[] buff = value.getAsByteArray();
         out.write(buff);

         return buff.length;
      }
      else
      {
         InputStream in;
         if (value instanceof StreamPersistedValueData)
         {

            StreamPersistedValueData streamed = (StreamPersistedValueData)value;
            if (streamed.isPersisted())
            {
               // already persisted in another Value, copy it to this Value
               in = streamed.getAsStream();
            }
            else
            {
               in = streamed.getStream();
               if (in == null)
               {
                  in = new FileInputStream(streamed.getTempFile());
               }
            }
         }
         else
         {
            in = value.getAsStream();
         }

         try
         {
            return copy(in, out);
         }
         finally
         {
            in.close();
         }
      }
   }
34611
protected Map<String, Object> getContinuationData() {
        Map<String, Object> data = new HashMap<String, Object>();
        data.put("proxyBuilder", localProxyBuilder.get());
        data.put("contexts", contexts.get());
        return data;
    }
707972
@SuppressWarnings("unchecked")
  public void addPersistentLinkData(HashMap hm)
  {
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "addPersistentLinkData", hm);

      // For a linkHandler, we store
     // 
     //    * The uuid of the link
     //    * The name of the link
     //    * The busName at the other end of the link
     //
      
     // The uuid of the destination
     hm.put("uuid",_uuid.toByteArray());

     // The name of the destination
     hm.put("name", _name); 
     
     // The name of the bus at the other end of the link
     hm.put("busName", _busName);
     
     // Is the destination localised on the home ME
     hm.put("hasLocal", new Boolean(hasLocal()));
           
     hm.put("type", _type);
     hm.put( "inboundUserid", _inboundUserid);  
     hm.put( "outboundUserid", _outboundUserid);  
     hm.put( "TBD", new Boolean(isToBeDeleted()));       
           
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "addPersistentLinkData");
  }
34930
public final List<DataSlice> getPersistentData()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "getPersistentData");

    ByteArrayOutputStream bos = new ByteArrayOutputStream();

    try
    {
      ObjectOutputStream oos = new ObjectOutputStream(bos);

      // First object stored should always be the version integer.
      oos.writeInt(getPersistentVersion());

      getPersistentData(oos);

      oos.close();
    }
    catch (Exception e)
    {
      FFDCFilter.processException(
        e,
        "com.ibm.ws.sib.processor.impl.store.itemstreams.SIMPItemStream.getPersistentData",
        "1:297:1.54",
        this);

      SibTr.exception(tc, e);

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

      throw new SIErrorException(e);
    }

    byte[] data = bos.toByteArray();

    List<DataSlice> dataSlices = new ArrayList<DataSlice>(1);
    dataSlices.add(new DataSlice(data));

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

    return dataSlices;
  }