io.datarouter.client.mysql.MysqlClientNodeFactory Maven / Gradle / Ivy
The newest version!
/*
* Copyright © 2009 HotPads ([email protected])
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.datarouter.client.mysql;
import io.datarouter.client.mysql.node.MysqlBlobNode;
import io.datarouter.client.mysql.node.MysqlNode;
import io.datarouter.client.mysql.node.MysqlNodeManager;
import io.datarouter.client.mysql.node.MysqlTallyNode;
import io.datarouter.model.databean.Databean;
import io.datarouter.model.entity.Entity;
import io.datarouter.model.key.entity.EntityKey;
import io.datarouter.model.key.primary.EntityPrimaryKey;
import io.datarouter.model.serialize.fielder.DatabeanFielder;
import io.datarouter.storage.client.imp.BlobClientNodeFactory;
import io.datarouter.storage.client.imp.DatabeanClientNodeFactory;
import io.datarouter.storage.client.imp.TallyClientNodeFactory;
import io.datarouter.storage.file.DatabaseBlob;
import io.datarouter.storage.file.DatabaseBlob.DatabaseBlobFielder;
import io.datarouter.storage.file.DatabaseBlobKey;
import io.datarouter.storage.node.NodeParams;
import io.datarouter.storage.node.adapter.NodeAdapters;
import io.datarouter.storage.node.entity.EntityNodeParams;
import io.datarouter.storage.node.op.raw.BlobStorage.PhysicalBlobStorageNode;
import io.datarouter.storage.node.op.raw.TallyStorage.PhysicalTallyStorageNode;
import io.datarouter.storage.node.type.physical.PhysicalNode;
import io.datarouter.storage.tally.Tally;
import io.datarouter.storage.tally.Tally.TallyFielder;
import io.datarouter.storage.tally.TallyKey;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;
@Singleton
public class MysqlClientNodeFactory
implements BlobClientNodeFactory, DatabeanClientNodeFactory, TallyClientNodeFactory{
@Inject
private MysqlClientType mysqlClientType;
@Inject
private MysqlNodeManager mysqlNodeManager;
@Inject
private NodeAdapters nodeAdapters;
/*---------------- DatabeanClientNodeFactory ------------------*/
@Override
public ,
E extends Entity,
PK extends EntityPrimaryKey,
D extends Databean,
F extends DatabeanFielder>
PhysicalNode createDatabeanNode(
EntityNodeParams entityNodeParams,
NodeParams nodeParams){
var node = new MysqlNode<>(nodeParams, mysqlClientType, mysqlNodeManager);
return nodeAdapters.wrapDatabeanIndexedNode(node);
}
@Override
public PhysicalTallyStorageNode createTallyNode(NodeParams nodeParams){
var node = new MysqlTallyNode(
nodeParams,
mysqlClientType,
mysqlNodeManager);
return nodeAdapters.wrapTallyNode(node);
}
@Override
public PhysicalBlobStorageNode createBlobNode(
NodeParams nodeParams){
var node = new MysqlBlobNode(mysqlNodeManager, nodeParams, mysqlClientType);
return nodeAdapters.wrapBlobNode(node);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy