This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shawn Feldman
committed
Jul 13, 2015
1 parent
a63c817
commit 09873ce
Showing
5 changed files
with
124 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
.../main/java/org/apache/usergrid/corepersistence/index/ReplicatedIndexLocationStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
/* | ||
* | ||
* * Licensed to the Apache Software Foundation (ASF) under one or more | ||
* * contributor license agreements. The ASF licenses this file to You | ||
* * 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. For additional information regarding | ||
* * copyright in this work, please see the NOTICE file in the top level | ||
* * directory of this distribution. | ||
* | ||
*/ | ||
package org.apache.usergrid.corepersistence.index; | ||
|
||
import org.apache.usergrid.persistence.core.scope.ApplicationScope; | ||
import org.apache.usergrid.persistence.index.IndexAlias; | ||
import org.apache.usergrid.persistence.index.IndexLocationStrategy; | ||
|
||
/** | ||
* Classy class class. | ||
*/ | ||
public class ReplicatedIndexLocationStrategy implements IndexLocationStrategy { | ||
|
||
private ReplicatedIndexAlias alias; | ||
private String rootName; | ||
private String indexInitialName; | ||
private ApplicationScope applicationScope; | ||
private int numberShards; | ||
private int numberReplicas; | ||
|
||
public ReplicatedIndexLocationStrategy(){ | ||
|
||
} | ||
|
||
public ReplicatedIndexLocationStrategy(IndexLocationStrategy indexLocationStrategy){ | ||
alias = new ReplicatedIndexAlias( indexLocationStrategy.getAlias() ); | ||
rootName = indexLocationStrategy.getIndexRootName(); | ||
indexInitialName = indexLocationStrategy.getIndexInitialName(); | ||
applicationScope = indexLocationStrategy.getApplicationScope(); | ||
numberShards = indexLocationStrategy.getNumberOfShards(); | ||
numberReplicas = indexLocationStrategy.getNumberOfReplicas(); | ||
} | ||
|
||
@Override | ||
public IndexAlias getAlias() { | ||
return alias; | ||
} | ||
|
||
@Override | ||
public String getIndexRootName() { | ||
return rootName; | ||
} | ||
|
||
@Override | ||
public String getIndexInitialName() { | ||
return indexInitialName; | ||
} | ||
|
||
@Override | ||
public ApplicationScope getApplicationScope() { | ||
return applicationScope; | ||
} | ||
|
||
@Override | ||
public int getNumberOfShards() { | ||
return numberShards; | ||
} | ||
|
||
@Override | ||
public int getNumberOfReplicas() { | ||
return numberReplicas; | ||
} | ||
|
||
public static class ReplicatedIndexAlias implements IndexAlias{ | ||
|
||
private String readAlias; | ||
private String writeAlias; | ||
|
||
public ReplicatedIndexAlias(){ | ||
|
||
} | ||
public ReplicatedIndexAlias(IndexAlias alias){ | ||
this.readAlias = alias.getReadAlias(); | ||
this.writeAlias = alias.getWriteAlias(); | ||
} | ||
@Override | ||
public String getReadAlias() { | ||
return readAlias; | ||
} | ||
|
||
@Override | ||
public String getWriteAlias() { | ||
return writeAlias; | ||
} | ||
} | ||
} |